Repository navigation
Conversation
A VPC-to-VPC site-to-site VPN needs one of its two connections in passive mode, which the resource could not express. Expose createVpnConnection's passive flag (ForceNew, CloudStack cannot update it) and read it back. This change was written with AI assistance (Claude Code). Generated-by: Claude Code (Claude Opus 5.5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CloudStack's VPC-to-VPC site-to-site VPN requires one of the two VPN connections to be passive: it waits for the other side to start the IPsec negotiation.
cloudstack_vpn_connectionhad no way to set this, so a VPC-to-VPC tunnel could not be built with provider resources alone. People had to callcreateVpnConnection passive=trueoutside Terraform (e.g.cmkin alocal-exec).This PR adds an optional
passiveargument tocloudstack_vpn_connection:passive(bool, optional, defaultfalse). It is passed tocreateVpnConnectionthroughSetPassive, which is already in cloudstack-go v2.19.1.ForceNew, becauseupdateVpnConnectioncannot change it.Testing
I tested this with OpenTofu against a real CloudStack zone, using two VPCs, two VPN gateways, two customer gateways, and one passive plus one active connection:
applycreated both connections.listVpnConnectionsreturnedpassive: truefor one andpassive: falsefor the other.planshowed no changes.state rmandimport, the connection came back withpassive = trueand no changes planned.passiveplanned a replacement.destroywas clean.go buildandgo vetpass. I did not run the acceptance test suite (TF_ACC) in CI conditions.How to test
TF_ACC=1 go test ./cloudstack -run TestAccCloudStackVPNConnection -v._basicchecks thatpassiveistrueonbar-fooandfalseonfoo-bar.cloudstack_vpn_gatewayand acloudstack_vpn_customer_gatewaypointing at the other one. Create onecloudstack_vpn_connectionwithpassive = trueand one without (depends_onthe passive one). Then runcmk list vpnconnections filter=id,passive,state. Once a VM sends traffic across, the tunnel comes up asConnected.Compatibility
Existing connections read
passive = falseby default, so nothing changes for them. If a connection was created passive outside Terraform, the next plan will show a replacement untilpassive = trueis set in the config.This PR was created with AI assistance (Claude Code). I reviewed the change and tested it against a live CloudStack environment.
🤖 Generated with Claude Code