feat: Add --what-if for Microsoft.Windows/FirewallRuleList#1530
feat: Add --what-if for Microsoft.Windows/FirewallRuleList#1530Gijsreyn wants to merge 3 commits into
--what-if for Microsoft.Windows/FirewallRuleList#1530Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class --what-if support for the built-in Microsoft.Windows/FirewallRuleList resource by wiring the manifest to pass a what-if flag through to windows_firewall set, projecting state instead of mutating, and surfacing what-if messages via _metadata.whatIf. Also extends the skill documentation with a reusable what-if implementation/testing pattern.
Changes:
- Resource manifest: add
whatIfArgandwhatIfReturnsfor thesetoperation, plus schema support for_metadata.whatIf. - Resource implementation: add
-w/--what-ifparsing and implement non-mutating projections (create/update/delete) with localized what-if messages. - Tests/docs: add a Pester suite for what-if and expand
.github/skills/create-dsc-resource/SKILL.mdwith what-if guidance.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/windows_firewall/windows_firewall.dsc.resource.json | Wires DSC what-if invocation (whatIfArg, whatIfReturns) and extends schema with _metadata.whatIf. |
| resources/windows_firewall/src/main.rs | Parses -w/--what-if and passes it into set_rules. |
| resources/windows_firewall/src/firewall.rs | Implements what-if behavior by projecting results instead of mutating and emitting _metadata.whatIf messages for create/remove. |
| resources/windows_firewall/src/types.rs | Adds _metadata model (Metadata) to the rule type for what-if message payloads. |
| resources/windows_firewall/locales/en-us.toml | Adds localized what-if strings for create/remove messages. |
| resources/windows_firewall/tests/windows_firewall_whatif.tests.ps1 | Adds Pester coverage for what-if create/update/delete/multi-rule behavior. |
| .github/skills/create-dsc-resource/SKILL.md | Documents a standardized what-if pattern for manifests, implementation, localization, and tests. |
SteveL-MSFT
left a comment
There was a problem hiding this comment.
Great job on adding the SKILL.md update!
| } | ||
| ``` | ||
|
|
||
| - `whatIfArg` is the literal CLI flag DSC will append when the user runs `dsc config set --what-if`. Always use `"-w"` (short form) for consistency across resources. |
There was a problem hiding this comment.
Since most resources won't also be used as CLI tools (although technically they could), would prefer to advise agent to use long form in the manifest --what-if as it makes it more obvious to a human reading the manifest
PR Summary
This pull request adds
--what-ifsupport forMicrosoft.Windows/FirewallRuleList. It also updates theSKILL.mdfile for re-usability across other resources created.PR Context
Partially addresses #1529