Skip to content

Add bypass_vlan_overlap_check parameter to cloudstack_private_gateway #283

Open
bhouse-nexthop wants to merge 3 commits intoapache:mainfrom
bhouse-nexthop:feature/private-gateway-bypass-vlan-overlap-check
Open

Add bypass_vlan_overlap_check parameter to cloudstack_private_gateway #283
bhouse-nexthop wants to merge 3 commits intoapache:mainfrom
bhouse-nexthop:feature/private-gateway-bypass-vlan-overlap-check

Conversation

@bhouse-nexthop
Copy link
Copy Markdown
Collaborator

@bhouse-nexthop bhouse-nexthop commented Mar 6, 2026

  • Add bypass_vlan_overlap_check 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)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 bypassvlanoverlapcheck argument 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, default false, 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.

Comment thread cloudstack/resource_cloudstack_private_gateway.go Outdated
Comment thread website/docs/r/private_gateway.html.markdown Outdated
@bhouse-nexthop
Copy link
Copy Markdown
Collaborator Author

@vishesh92 code review comments addressed, please re-request from copilot

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread cloudstack/resource_cloudstack_private_gateway.go Outdated
Copy link
Copy Markdown
Member

@vishesh92 vishesh92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm. didn't test.

@bhouse-nexthop bhouse-nexthop changed the title Add bypassvlanoverlapcheck parameter to cloudstack_private_gateway Add bypass_vlan_overlap_check parameter to cloudstack_private_gateway Mar 11, 2026
Copy link
Copy Markdown
Member

@vishesh92 vishesh92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm. didn't test.

…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.
@bhouse-nexthop bhouse-nexthop force-pushed the feature/private-gateway-bypass-vlan-overlap-check branch from a5a909c to 2ae48f0 Compare April 15, 2026 13:43
@vishesh92
Copy link
Copy Markdown
Member

@bhouse-nexthop I found a bug.

  1. apply the terraform
resource "cloudstack_private_gateway" "bar" {
  gateway = "10.1.1.254"
  ip_address = "192.168.0.2"
  netmask = "255.255.255.0"
  vlan = "2"
  vpc_id = cloudstack_vpc.bar.id
  acl_id = cloudstack_network_acl.bar.id
  bypass_vlan_overlap_check = true
  depends_on = ["cloudstack_vpc.bar","cloudstack_network_acl.bar"]
}
  1. Change value of bypass_vlan_overlap_check = true to false and apply again.
  Enter a value: yes

cloudstack_private_gateway.bar: Modifying... [id=01811bb0-ed14-441b-a65e-3a0ce9e218fc]
╷
│ Error: Request cancelled
│ 
│ The plugin6.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-cloudstack plugin:

panic: interface conversion: interface {} is nil, not string

goroutine 82 [running]:
github.com/terraform-providers/terraform-provider-cloudstack/cloudstack.resourceCloudStackNetworkRead(0xc0005aea80, {0x14599a0?, 0xc0004faa08})
        /home/vishesh/lab/apache/cloudstack-terraform-provider/cloudstack/resource_cloudstack_network.go:289 +0xb25
github.com/terraform-providers/terraform-provider-cloudstack/cloudstack.resourceCloudStackPrivateGatewayUpdate(0xc0005aea80, {0x14599a0, 0xc0004faa08})
        /home/vishesh/lab/apache/cloudstack-terraform-provider/cloudstack/resource_cloudstack_private_gateway.go:183 +0x25f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x178e0d8?, {0x178e0d8?, 0xc0003e9a40?}, 0xd?, {0x14599a0?, 0xc0004faa08?})
        /home/vishesh/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:800 +0x15f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0003117a0, {0x178e0d8, 0xc0003e9a40}, 0xc0004b2410, 0xc0005ae900, {0x14599a0, 0xc0004faa08})
        /home/vishesh/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:919 +0x81a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000013740, {0x178e0d8?, 0xc0003e98c0?}, 0xc000146460)
        /home/vishesh/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:1078 +0xd5c
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ApplyResourceChange({{0x1799050?, 0xc000013740?}}, {0x178e0d8, 0xc0003e98c0}, 0x0?)
        /home/vishesh/go/pkg/mod/github.com/hashicorp/terraform-plugin-mux@v0.16.0/tf5to6server/tf5to6server.go:38 +0x54
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ApplyResourceChange(0xc0002858f0, {0x178e0d8?, 0xc0003e95f0?}, 0xc000146410)
        /home/vishesh/go/pkg/mod/github.com/hashicorp/terraform-plugin-mux@v0.16.0/tf6muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc00027f7c0, {0x178e0d8?, 0xc0003e8c00?}, 0xc00023c0e0)
        /home/vishesh/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.24.0/tfprotov6/tf6server/server.go:865 +0x3bc
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x14fc080, 0xc00027f7c0}, {0x178e0d8, 0xc0003e8c00}, 0xc0005ae000, 0x0)
        /home/vishesh/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.24.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:545 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001c0e00, {0x178e0d8, 0xc0003e8b70}, {0x1795040, 0xc0004f2000}, 0xc0005aa000, 0xc0003e8870, 0x2199858, 0x0)
        /home/vishesh/go/pkg/mod/google.golang.org/grpc@v1.66.2/server.go:1394 +0xe2b
google.golang.org/grpc.(*Server).handleStream(0xc0001c0e00, {0x1795040, 0xc0004f2000}, 0xc0005aa000)
        /home/vishesh/go/pkg/mod/google.golang.org/grpc@v1.66.2/server.go:1805 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        /home/vishesh/go/pkg/mod/google.golang.org/grpc@v1.66.2/server.go:1029 +0x7f
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 37
        /home/vishesh/go/pkg/mod/google.golang.org/grpc@v1.66.2/server.go:1040 +0x125

Error: The terraform-provider-cloudstack plugin crashed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants