terraform configuration example for ibm cloud VPN gateway setup, and use this a reference implementation for vpn gateway terraform configuration
What will be done in this vpn-gateway terraform configuration example:
- Create one VPC
- Create one subnet
- Create VPN gateway
- Create VPN connection
- Create custom route if the VPN mode is "route".
For create policy based VPN:
tfa --var peer_address=1.2.3.4 --var preshared_key=my-preshare-key --var 'peer_cidrs=["192.168.0.0/24","192.168.1.0/24"]' --var 'mode=policy' -auto-approve
For create route based VPN:
tfa --var peer_address=1.2.3.4 --var preshared_key=my-preshare-key --var 'peer_cidrs=["192.168.0.0/24","192.168.1.0/24"]' -auto-approve
export IBMCLOUD_API_KEY=<YOUR_IBM_CLOUD_API_KEY>
This is only done once while you intialized your terraform directory.
terraform init
terraform plan
terraform apply