Skip to content

Commit

Permalink
Use the new option to list ACLs based on the ID and VPC ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Sander van Harmelen committed May 18, 2016
1 parent 640152e commit 6a08e89
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion builtin/providers/cloudstack/resource_cloudstack_network_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 6a08e89

Please sign in to comment.