Add bypass_vlan_overlap_check parameter to cloudstack_private_gateway - #283
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for an optional bypassvlanoverlapcheck flag on cloudstack_private_gateway, enabling callers to bypass CloudStack’s VLAN overlap validation at creation time.
Changes:
- Documented the new
bypassvlanoverlapcheckargument and added an HCL example. - Extended the private gateway resource schema and create logic to pass the flag to the CloudStack API.
- Added/updated acceptance tests to cover explicit
true, defaultfalse, and import behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
cloudstack/resource_cloudstack_private_gateway.go |
Adds schema field and wires it into the Create API call. |
cloudstack/resource_cloudstack_private_gateway_test.go |
Adds acceptance tests and updates import verification to ignore the new field. |
website/docs/r/private_gateway.html.markdown |
Documents the new argument and provides an example configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@vishesh92 code review comments addressed, please re-request from copilot |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…source - Add bypassvlanoverlapcheck optional parameter (defaults to false) - Parameter allows bypassing VLAN overlap checks during gateway creation - Update resource creation logic to pass parameter to CloudStack API - Add comprehensive test coverage: - Test with bypass enabled - Test default value (false) - Update import test to ignore field (not returned by API) - Update documentation with examples and parameter description - All acceptance tests passing (4/4)
… consistency The parameter name has been changed from camelCase (bypassvlanoverlapcheck) to snake_case (bypass_vlan_overlap_check) to maintain consistency with other resource arguments like ip_address, physical_network_id, and acl_id. This change affects: - Resource schema definition - Resource creation logic - Test cases and assertions - Documentation examples The parameter is now also marked as ForceNew since it can only be set during gateway creation and cannot be modified afterwards.
a5a909c to
2ae48f0
Compare
|
@bhouse-nexthop I found a bug.
|
|
Hi @bhouse-nexthop Can you check the outstanding comments here. Thanks. |
resourceCloudStackPrivateGatewayUpdate called resourceCloudStackNetworkRead
instead of resourceCloudStackPrivateGatewayRead. The network read does
d.Get("project").(string), but the private gateway resource has no
"project" attribute, so the type assertion panicked (interface {} is nil,
not string) on any update (e.g. changing acl_id or bypass_vlan_overlap_check).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@vishesh92 @sureshanaparti thanks for the report and the ping — fixed in 46a69f6. Root cause: |
…ay-bypass-vlan-overlap-check # Conflicts: # website/docs/r/private_gateway.html.markdown
|
Take a call for as #166 solves the same issue |
|
@kiranchavala PR #166 covers 'bypass_vlan_check' for network and private gateway, here it is 'bypass_vlan_overlap_check' and is covered for private gateway only. cc @sudo87 @vishesh92 |
kiranchavala
left a comment
There was a problem hiding this comment.
LGTM tested manually
resource "cloudstack_private_gateway" "with_bypass" {
gateway = "10.0.0.1"
ip_address = "10.0.0.2"
netmask = "255.255.255.252"
vlan = "200"
vpc_id = "cfa1c8b3-2891-4273-ab79-5e1ee6024937"
acl_id = "6b0d728b-6648-11f1-afab-bc2411acabdc"
bypass_vlan_overlap_check = true
}
terraform apply
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated
with the following symbols:
+ create
Terraform will perform the following actions:
# cloudstack_private_gateway.with_bypass will be created
+ resource "cloudstack_private_gateway" "with_bypass" {
+ acl_id = "6b0d728b-6648-11f1-afab-bc2411acabdc"
+ bypass_vlan_overlap_check = true
+ gateway = "10.0.0.1"
+ id = (known after apply)
+ ip_address = "10.0.0.2"
+ netmask = "255.255.255.252"
+ vlan = "200"
+ vpc_id = "cfa1c8b3-2891-4273-ab79-5e1ee6024937"
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
cloudstack_private_gateway.with_bypass: Creating...
cloudstack_private_gateway.with_bypass: Creation complete after 6s [id=d3249d3a-a170-4f6a-b841-77a77f7ff35c]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Terraform destroy
terraform destroy
cloudstack_private_gateway.with_bypass: Refreshing state... [id=d3249d3a-a170-4f6a-b841-77a77f7ff35c]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated
with the following symbols:
- destroy
Terraform will perform the following actions:
# cloudstack_private_gateway.with_bypass will be destroyed
- resource "cloudstack_private_gateway" "with_bypass" {
- acl_id = "6b0d728b-6648-11f1-afab-bc2411acabdc" -> null
- bypass_vlan_overlap_check = true -> null
- gateway = "10.0.0.1" -> null
- id = "d3249d3a-a170-4f6a-b841-77a77f7ff35c" -> null
- ip_address = "10.0.0.2" -> null
- netmask = "255.255.255.252" -> null
- vlan = "200" -> null
- vpc_id = "cfa1c8b3-2891-4273-ab79-5e1ee6024937" -> null
}
Plan: 0 to add, 0 to change, 1 to destroy.
Do you really want to destroy all resources?
Terraform will destroy all your managed infrastructure, as shown above.
There is no undo. Only 'yes' will be accepted to confirm.
Enter a value: yes
cloudstack_private_gateway.with_bypass: Destroying... [id=d3249d3a-a170-4f6a-b841-77a77f7ff35c]
cloudstack_private_gateway.with_bypass: Destruction complete after 3s
Destroy complete! Resources: 1 destroyed.
|
thank you @kiranchavala |
…import test The merge with main pulled in bypass_vlan_overlap_check (added separately in apache#283), which duplicates this branch's own bypass_vlan_check field on cloudstack_private_gateway. Drop the stale duplicate and the overlapping test resource that relied on it, and ignore bypass_vlan_check on network import since CloudStack's network API never returns it.
Uh oh!
There was an error while loading. Please reload this page.