Skip to content

Commit b93d1a5

Browse files
committed
Fix all-ports rule state handling
- Clear ports field when creating all-ports rules - Clear ports field when reading all-ports rules - Ensure test expectations match actual state behavior - Fixes test failures where ports field was incorrectly set
1 parent 56b0cc3 commit b93d1a5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

cloudstack/resource_cloudstack_egress_firewall.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ func createEgressFirewallRule(d *schema.ResourceData, meta interface{}, rule map
335335
}
336336
uuids["all"] = r.Id
337337
rule["uuids"] = uuids
338+
// Clear the ports field since we're creating an all-ports rule
339+
rule["ports"] = &schema.Set{F: schema.HashString}
338340
}
339341
}
340342

@@ -486,6 +488,8 @@ func resourceCloudStackEgressFirewallRead(d *schema.ResourceData, meta interface
486488
// Update the values
487489
rule["protocol"] = r.Protocol
488490
rule["cidr_list"] = cidrs
491+
// Clear ports field for all-ports rules
492+
rule["ports"] = &schema.Set{F: schema.HashString}
489493
rules.Add(rule)
490494
}
491495
}
@@ -512,6 +516,8 @@ func resourceCloudStackEgressFirewallRead(d *schema.ResourceData, meta interface
512516

513517
rule["protocol"] = r.Protocol
514518
rule["cidr_list"] = cidrs
519+
// Clear ports field for all-ports rules
520+
rule["ports"] = &schema.Set{F: schema.HashString}
515521
rules.Add(rule)
516522

517523
// Remove from ruleMap so it's not processed again

0 commit comments

Comments
 (0)