From 6a08e893e37ee2ca1dde05d36bbee5d8edca790d Mon Sep 17 00:00:00 2001 From: Sander van Harmelen Date: Wed, 18 May 2016 14:43:21 +0200 Subject: [PATCH] Use the new option to list ACLs based on the ID and VPC ID --- .../resource_cloudstack_network_acl.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/builtin/providers/cloudstack/resource_cloudstack_network_acl.go b/builtin/providers/cloudstack/resource_cloudstack_network_acl.go index c39c695d9b76..15569d09f396 100644 --- a/builtin/providers/cloudstack/resource_cloudstack_network_acl.go +++ b/builtin/providers/cloudstack/resource_cloudstack_network_acl.go @@ -90,8 +90,22 @@ func resourceCloudStackNetworkACLCreate(d *schema.ResourceData, meta interface{} func resourceCloudStackNetworkACLRead(d *schema.ResourceData, meta interface{}) error { cs := meta.(*cloudstack.CloudStackClient) + vpc, ok := d.GetOk("vpc_id") + if !ok { + vpc, ok = d.GetOk("vpc") + } + if !ok { + return errors.New("Either `vpc_id` or [deprecated] `vpc` must be provided.") + } + + // Retrieve the vpc ID + vpcid, e := retrieveID(cs, "vpc", vpc.(string)) + if e != nil { + return e.Error() + } + // Get the network ACL list details - f, count, err := cs.NetworkACL.GetNetworkACLListByID(d.Id()) + f, count, err := cs.NetworkACL.GetNetworkACLListByID(d.Id(), cloudstack.WithVPCID(vpcid)) if err != nil { if count == 0 { log.Printf(