@@ -70,6 +70,13 @@ func resourceCloudStackEgressFirewall() *schema.Resource {
7070 Set : schema .HashString ,
7171 },
7272
73+ "dest_cidr_list" : {
74+ Type : schema .TypeSet ,
75+ Optional : true ,
76+ Elem : & schema.Schema {Type : schema .TypeString },
77+ Set : schema .HashString ,
78+ },
79+
7380 "protocol" : {
7481 Type : schema .TypeString ,
7582 Required : true ,
@@ -194,6 +201,15 @@ func createEgressFirewallRule(d *schema.ResourceData, meta interface{}, rule map
194201 p .SetCidrlist (cidrList )
195202 }
196203
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+
197213 // If the protocol is ICMP set the needed ICMP parameters
198214 if rule ["protocol" ].(string ) == "icmp" {
199215 p .SetIcmptype (rule ["icmp_type" ].(int ))
@@ -319,11 +335,18 @@ func resourceCloudStackEgressFirewallRead(d *schema.ResourceData, meta interface
319335 cidrs .Add (cidr )
320336 }
321337
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+
322344 // Update the values
323345 rule ["protocol" ] = r .Protocol
324346 rule ["icmp_type" ] = r .Icmptype
325347 rule ["icmp_code" ] = r .Icmpcode
326348 rule ["cidr_list" ] = cidrs
349+ rule ["dest_cidr_list" ] = destcidrs
327350 rules .Add (rule )
328351 }
329352
@@ -357,9 +380,16 @@ func resourceCloudStackEgressFirewallRead(d *schema.ResourceData, meta interface
357380 cidrs .Add (cidr )
358381 }
359382
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+
360389 // Update the values
361390 rule ["protocol" ] = r .Protocol
362391 rule ["cidr_list" ] = cidrs
392+ rule ["dest_cidr_list" ] = destcidrs
363393 ports .Add (port )
364394 }
365395
0 commit comments