cloudstack-terraform-provider
cloudstack-terraform-provider copied to clipboard
Allow connecting network ACL to a (VPC) network according API specs
As per Apache CloudStack API, the method createNetworkACL supports a network ID as parameter.
According to this provider's documentation, it offers linking network ACL to a VPC ID, but not to a given network ID.
Currently, running the call through provider indeed links the network ACL to the VPC (possibly by the VPC's API parameter), but the application of the network ACL to a network can be as I assume done only from the network side.
@vishesh92
Need to add networkid parameter to the "resource_cloudstack_network_acl"
https://cloudstack.apache.org/api/apidocs-4.19/apis/createNetworkACL.html
https://github.com/apache/cloudstack-go/blob/main/cloudstack/NetworkACLService.go
When i performed the changes getting a build error
"network_id": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
if networkid, ok := d.GetOk("network_id"); ok {
p.SetNetworkid(networkid.(string))
}
cloudstack-terraform-provider git:(add-networkid) ✗ make build
==> Checking that code complies with gofmt requirements...
go install
# github.com/terraform-providers/terraform-provider-cloudstack/cloudstack
cloudstack/resource_cloudstack_network_acl.go:91:5: p.SetNetworkid undefined (type *"github.com/apache/cloudstack-go/v2/cloudstack".CreateNetworkACLListParams has no field or method SetNetworkid)
make: *** [build] Error 1
@synergiator resource_cloudstack_network_acl is actually a network ACL list. And resource_cloudstack_network_acl_rule is the network ACL. Network ACL requires a aclid (ACL List's uuid). If you don't pass aclid and pass network id, cloudstack will check if the network has a VPC and checks for existing acl id. If it doesn't find one, it creates a new ACL list and use that.