Skip to content

Commit 6a08e89

Browse files
author
Sander van Harmelen
committed
Use the new option to list ACLs based on the ID and VPC ID
1 parent 640152e commit 6a08e89

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

builtin/providers/cloudstack/resource_cloudstack_network_acl.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,22 @@ func resourceCloudStackNetworkACLCreate(d *schema.ResourceData, meta interface{}
9090
func resourceCloudStackNetworkACLRead(d *schema.ResourceData, meta interface{}) error {
9191
cs := meta.(*cloudstack.CloudStackClient)
9292

93+
vpc, ok := d.GetOk("vpc_id")
94+
if !ok {
95+
vpc, ok = d.GetOk("vpc")
96+
}
97+
if !ok {
98+
return errors.New("Either `vpc_id` or [deprecated] `vpc` must be provided.")
99+
}
100+
101+
// Retrieve the vpc ID
102+
vpcid, e := retrieveID(cs, "vpc", vpc.(string))
103+
if e != nil {
104+
return e.Error()
105+
}
106+
93107
// Get the network ACL list details
94-
f, count, err := cs.NetworkACL.GetNetworkACLListByID(d.Id())
108+
f, count, err := cs.NetworkACL.GetNetworkACLListByID(d.Id(), cloudstack.WithVPCID(vpcid))
95109
if err != nil {
96110
if count == 0 {
97111
log.Printf(

0 commit comments

Comments
 (0)