CodeBleu commented on issue #106:
URL:
https://github.com/apache/cloudstack-terraform-provider/issues/106#issuecomment-2147673784
I wish I new more Go so I could write a proper go test for this. I was able
to do a basic test of adding descriptions to Rules and also adding Rules with a
Rule ID # ( as along as the existing Rule ID # doesn't exist). Updating
existing rule with a Rule ID # that already exists produces the following:
> * CloudStack API error 431 (CSExceptionErrorCode: 4350): ACL item with
number 1 already exists in ACL: 8590d921-9972-4a71-9d28-e4b5616faed2
I would have submitted a PR if I had some better logic to handle existing
Rule ID #'s and proper testing, but since I'm a n00b at this Go stuff I figured
I'd at least post the git diff patch :smile:
```
diff --git a/cloudstack/resource_cloudstack_network_acl_rule.go
b/cloudstack/resource_cloudstack_network_acl_rule.go
index f2daac7..12590ac 100644
--- a/cloudstack/resource_cloudstack_network_acl_rule.go
+++ b/cloudstack/resource_cloudstack_network_acl_rule.go
@@ -63,6 +63,16 @@ func resourceCloudStackNetworkACLRule() *schema.Resource {
Default: "allow",
},
+ "description": {
+ Type: schema.TypeString,
+ Optional: true,
+ },
+
+ "rule_id": {
+ Type: schema.TypeInt,
+ Optional: true,
+ },
+
"cidr_list": {
Type: schema.TypeSet,
Required: true,
@@ -198,6 +208,14 @@ func createNetworkACLRule(d *schema.ResourceData, meta
interface{}, rule map[str
// Create a new parameter struct
p := cs.NetworkACL.NewCreateNetworkACLParams(rule["protocol"].(string))
+ if desc, ok := rule["description"]; ok {
+ p.SetReason(desc.(string))
+ }
+
+ if ruleId, ok := rule["rule_id"]; ok {
+ p.SetNumber(ruleId.(int))
+ }
+
// Set the acl ID
p.SetAclid(d.Id())
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]