@@ -57,6 +57,12 @@ func resourceCloudStackNetworkACLRule() *schema.Resource {
5757 Optional : true ,
5858 Elem : & schema.Resource {
5959 Schema : map [string ]* schema.Schema {
60+ "rule_id" : {
61+ Type : schema .TypeInt ,
62+ Optional : true ,
63+ Computed : true ,
64+ },
65+
6066 "action" : {
6167 Type : schema .TypeString ,
6268 Optional : true ,
@@ -100,6 +106,11 @@ func resourceCloudStackNetworkACLRule() *schema.Resource {
100106 Default : "ingress" ,
101107 },
102108
109+ "description" : {
110+ Type : schema .TypeString ,
111+ Optional : true ,
112+ },
113+
103114 "uuids" : {
104115 Type : schema .TypeMap ,
105116 Computed : true ,
@@ -198,6 +209,11 @@ func createNetworkACLRule(d *schema.ResourceData, meta interface{}, rule map[str
198209 // Create a new parameter struct
199210 p := cs .NetworkACL .NewCreateNetworkACLParams (rule ["protocol" ].(string ))
200211
212+ // If a rule ID is specified, set it
213+ if ruleId , ok := rule ["rule_id" ].(int ); ok && ruleId > 0 {
214+ p .SetNumber (ruleId )
215+ }
216+
201217 // Set the acl ID
202218 p .SetAclid (d .Id ())
203219
@@ -214,6 +230,11 @@ func createNetworkACLRule(d *schema.ResourceData, meta interface{}, rule map[str
214230 // Set the traffic type
215231 p .SetTraffictype (rule ["traffic_type" ].(string ))
216232
233+ // Set the description
234+ if desc , ok := rule ["description" ].(string ); ok && desc != "" {
235+ p .SetReason (desc )
236+ }
237+
217238 // If the protocol is ICMP set the needed ICMP parameters
218239 if rule ["protocol" ].(string ) == "icmp" {
219240 p .SetIcmptype (rule ["icmp_type" ].(int ))
@@ -623,6 +644,15 @@ func verifyNetworkACLParams(d *schema.ResourceData) error {
623644}
624645
625646func verifyNetworkACLRuleParams (d * schema.ResourceData , rule map [string ]interface {}) error {
647+ if ruleId , ok := rule ["rule_id" ]; ok && ruleId != nil {
648+ if rId , ok := ruleId .(int ); ok && rId > 0 {
649+ if rId < 1 || rId > 65535 {
650+ return fmt .Errorf (
651+ "%q must be between %d and %d inclusive, got: %d" , "rule_id" , 1 , 65535 , rId )
652+ }
653+ }
654+ }
655+
626656 action := rule ["action" ].(string )
627657 if action != "allow" && action != "deny" {
628658 return fmt .Errorf ("Parameter action only accepts 'allow' or 'deny' as values" )
0 commit comments