Skip to content

Commit dc603d2

Browse files
committed
reverted some changes that required egress fw rules to be re-created; ensure the new feature is optional and fully backward-compatible
1 parent d155cfc commit dc603d2

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

cloudstack/resource_cloudstack_egress_firewall.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,6 @@ func createEgressFirewallRule(d *schema.ResourceData, meta interface{}, rule map
201201
p.SetCidrlist(cidrList)
202202
}
203203

204-
// Set the destination CIDR list
205-
var destcidrList []string
206-
if rs := rule["cidr_list"].(*schema.Set); rs.Len() > 0 {
207-
for _, cidr := range rule["dest_cidr_list"].(*schema.Set).List() {
208-
destcidrList = append(destcidrList, cidr.(string))
209-
}
210-
p.SetDestcidrlist(destcidrList)
211-
}
212-
213204
// If the protocol is ICMP set the needed ICMP parameters
214205
if rule["protocol"].(string) == "icmp" {
215206
p.SetIcmptype(rule["icmp_type"].(int))
@@ -329,24 +320,10 @@ func resourceCloudStackEgressFirewallRead(d *schema.ResourceData, meta interface
329320
// Delete the known rule so only unknown rules remain in the ruleMap
330321
delete(ruleMap, id.(string))
331322

332-
// Create a set with all CIDR's
333-
cidrs := &schema.Set{F: schema.HashString}
334-
for _, cidr := range strings.Split(r.Cidrlist, ",") {
335-
cidrs.Add(cidr)
336-
}
337-
338-
// Create a set with all destination CIDR's
339-
destcidrs := &schema.Set{F: schema.HashString}
340-
for _, cidr := range strings.Split(r.Destcidrlist, ",") {
341-
destcidrs.Add(cidr)
342-
}
343-
344323
// Update the values
345324
rule["protocol"] = r.Protocol
346325
rule["icmp_type"] = r.Icmptype
347326
rule["icmp_code"] = r.Icmpcode
348-
rule["cidr_list"] = cidrs
349-
rule["dest_cidr_list"] = destcidrs
350327
rules.Add(rule)
351328
}
352329

@@ -380,16 +357,9 @@ func resourceCloudStackEgressFirewallRead(d *schema.ResourceData, meta interface
380357
cidrs.Add(cidr)
381358
}
382359

383-
// Create a set with all destination CIDR's
384-
destcidrs := &schema.Set{F: schema.HashString}
385-
for _, cidr := range strings.Split(r.Destcidrlist, ",") {
386-
destcidrs.Add(cidr)
387-
}
388-
389360
// Update the values
390361
rule["protocol"] = r.Protocol
391362
rule["cidr_list"] = cidrs
392-
rule["dest_cidr_list"] = destcidrs
393363
ports.Add(port)
394364
}
395365

0 commit comments

Comments
 (0)