Skip to content

Commit a8e804b

Browse files
Add cloudstack_network_acl_ruleset resource with comprehensive ACL management
This commit introduces a new resource for managing network ACL rules with several improvements over the legacy cloudstack_network_acl_rule resource. Key Features: - Declarative ruleset management with efficient in-place updates - Rules identified by rule_number (natural key) instead of list position - Eliminates spurious diffs when modifying individual rules - Optional managed mode to delete out-of-band rules - Concurrent rule operations with proper synchronization - Support for protocol transitions (e.g., TCP to ICMP) Technical Implementation: - Uses TypeSet with Optional+Computed pattern for rules - CustomizeDiff function to suppress spurious diffs by comparing rules via rule_number - Three-phase update strategy: delete, update, create (preserves UUIDs) - Managed mode uses dummy rules to track out-of-band changes - Helper function buildRuleFromAPI() to eliminate code duplication - Safe type assertions to prevent runtime panics - Proper validation placement in verifyACLRuleParams Legacy Resource Updates: - Deprecated cloudstack_network_acl_rule with migration guidance - Added deprecation notice to documentation - Maintains backward compatibility Testing: - 12 comprehensive acceptance tests covering all scenarios - Tests for basic CRUD, managed mode, protocol transitions, field changes - Import functionality testing - Spurious diff prevention verification - All tests passing Documentation: - Complete user guide with multiple examples - Clear migration path from legacy resource - Accurate field descriptions (no unsupported features mentioned)
1 parent 403bb66 commit a8e804b

7 files changed

+3690
-3188
lines changed

cloudstack/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ func Provider() *schema.Provider {
130130
"cloudstack_network": resourceCloudStackNetwork(),
131131
"cloudstack_network_acl": resourceCloudStackNetworkACL(),
132132
"cloudstack_network_acl_rule": resourceCloudStackNetworkACLRule(),
133+
"cloudstack_network_acl_ruleset": resourceCloudStackNetworkACLRuleset(),
133134
"cloudstack_nic": resourceCloudStackNIC(),
134135
"cloudstack_physical_network": resourceCloudStackPhysicalNetwork(),
135136
"cloudstack_pod": resourceCloudStackPod(),

0 commit comments

Comments
 (0)