Use the new option to list ACLs based on the ID and VPC ID

This commit is contained in:
Sander van Harmelen 2016-05-18 14:43:21 +02:00
parent 640152e310
commit 6a08e893e3
1 changed files with 15 additions and 1 deletions

View File

@ -90,8 +90,22 @@ func resourceCloudStackNetworkACLCreate(d *schema.ResourceData, meta interface{}
func resourceCloudStackNetworkACLRead(d *schema.ResourceData, meta interface{}) error { func resourceCloudStackNetworkACLRead(d *schema.ResourceData, meta interface{}) error {
cs := meta.(*cloudstack.CloudStackClient) 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 // 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 err != nil {
if count == 0 { if count == 0 {
log.Printf( log.Printf(