Skip to content

Commit f14f64a

Browse files
committed
CRITICAL FIX: Restore delete(rule, 'ports') for all-ports rules
This fixes the core issue causing test failures: - TestCheckNoResourceAttr expects ports field to be completely absent - Without delete(rule, 'ports'), the field remains in state - This was the root cause of the 21 failing GitHub Actions tests The fix ensures: - All-ports rules have ports field completely removed from state - Matches test expectations in TestAccCloudStackEgressFirewall_allPortsTCP - Fixes both create and read operations for all-ports rules
1 parent 94bedc5 commit f14f64a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

cloudstack/resource_cloudstack_egress_firewall.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,12 @@ func createEgressFirewallRule(d *schema.ResourceData, meta interface{}, rule map
331331
// by not setting startport and endport parameters
332332
r, err := cs.Firewall.CreateEgressFirewallRule(p)
333333
if err != nil {
334-
return err
334+
return fmt.Errorf("failed to create all-ports egress firewall rule: %w", err)
335335
}
336336
uuids["all"] = r.Id
337337
rule["uuids"] = uuids
338+
// Remove the ports field since we're creating an all-ports rule
339+
delete(rule, "ports")
338340
}
339341
}
340342

@@ -501,6 +503,8 @@ func resourceCloudStackEgressFirewallRead(d *schema.ResourceData, meta interface
501503
// Update the values
502504
rule["protocol"] = r.Protocol
503505
rule["cidr_list"] = cidrs
506+
// Remove ports field for all-ports rules
507+
delete(rule, "ports")
504508
rules.Add(rule)
505509
}
506510
}

0 commit comments

Comments
 (0)