cloudstack-terraform-provider icon indicating copy to clipboard operation
cloudstack-terraform-provider copied to clipboard

Allow connecting network ACL to a (VPC) network according API specs

Open synergiator opened this issue 3 years ago • 2 comments

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.

synergiator avatar Dec 27 '21 14:12 synergiator

@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

kiranchavala avatar Mar 05 '24 16:03 kiranchavala

@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.

vishesh92 avatar Mar 07 '24 07:03 vishesh92