Use the new option to list ACLs based on the ID and VPC ID
This commit is contained in:
parent
640152e310
commit
6a08e893e3
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue