Skip to content

feat(firewall): add firewall management resources - #422

Merged
ffalor merged 8 commits into
mainfrom
feat-firewall-resources
Jul 8, 2026
Merged

feat(firewall): add firewall management resources#422
ffalor merged 8 commits into
mainfrom
feat-firewall-resources

Conversation

@ffalor

@ffalor ffalor commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Supersedes #344 by @tphilll. Includes the original firewall contribution plus additional refinements:

  • rename test_mode -> monitor_mode and add validation requiring enforce
  • drop last_updated and the rule-level log field
  • migrate error handling to tferrors.NewDiagnosticFromAPIError
  • fix Linux platform ID mapping (2 -> 3)
  • support clearing an empty policy description
  • map address_family ANY<->NONE and add ESP to Linux-unsupported protocols
  • simplify precedence dynamic enforcement handling
  • expose host groups, rule group IDs, container settings, and nested rules in the firewall data sources

tphilll and others added 8 commits April 9, 2026 16:05
…rces

Implements CrowdStrike firewall management capabilities for Terraform:

Resources:
- crowdstrike_firewall_rule_group: Manage firewall rule groups with nested rules
- crowdstrike_firewall_policy: Manage firewall policies with host groups and settings
- crowdstrike_firewall_policy_precedence: Control policy ordering/priority

Data Sources:
- crowdstrike_firewall_policies: Query existing firewall policies
- crowdstrike_firewall_rule_groups: Query existing rule groups

Closes #99
…tion

Bug fixes discovered during verification testing:

1. Log field not preserved: API doesn't return log field, causing drift
   - Preserve plan's log value in wrapRules when reading back from API

2. Single port handling: start=443, end=443 caused API 'duplicate ports' error
   - Convert to end=0 when sending to API
   - Restore plan's end value when reading back (if plan had start==end)

3. Precedence dynamic enforcement race condition:
   - Parallel tests changing policy count caused failures
   - Preserve plan IDs in state for dynamic mode instead of reading from API
   - Changed precedence tests to sequential to avoid interference

All 29 acceptance tests pass.
This removes all duplicate calls that were introduced during the merge conflict resolution
Rename the schema-visible test_mode attribute to monitor_mode and drop
the last_updated and rule-level log fields across the firewall policy,
rule group, and precedence resources.

- migrate error handling to tferrors.NewDiagnosticFromAPIError with
  read/read-write scopes and not-found handling
- add config validation: monitor_mode requires enforce, and
  address_family=ANY conflicts with local/remote addresses
- fix Linux platform ID mapping (2 -> 3)
- support clearing an empty policy description via a custom request type
  that drops omitempty
- map address_family ANY<->NONE and add ESP to Linux-unsupported protocols
- simplify precedence dynamic enforcement by truncating to the managed
  count instead of branching on preserve-plan-IDs
- expose host_groups, rule_group_ids, container settings, and nested
  rules in the firewall data sources
# Conflicts:
#	internal/provider/provider.go
#	internal/sweep/sweep_test.go
@ffalor
ffalor merged commit b672503 into main Jul 8, 2026
11 checks passed
@ffalor
ffalor deleted the feat-firewall-resources branch July 8, 2026 20:52
adelfazel pushed a commit to adelfazel/terraform-provider-crowdstrike that referenced this pull request Jul 13, 2026
* feat(firewall): add firewall rule group, policy, and precedence resources

Implements CrowdStrike firewall management capabilities for Terraform:

Resources:
- crowdstrike_firewall_rule_group: Manage firewall rule groups with nested rules
- crowdstrike_firewall_policy: Manage firewall policies with host groups and settings
- crowdstrike_firewall_policy_precedence: Control policy ordering/priority

Data Sources:
- crowdstrike_firewall_policies: Query existing firewall policies
- crowdstrike_firewall_rule_groups: Query existing rule groups

---------

Co-authored-by: tphilll <153414806+tphilll@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants