Proceed step by step:
- First, comment out the creation of the Customer Gateway on the Scaleway side and the
aws.tffile. This allows you to retrieve the public IP of the Scaleway VPN Gateway. - Then, uncomment on the AWS side to get the tunnel IP address.
- Finally, provide the correct PSK to finalize the link (retrieve the Scaleway PSK and set it on the AWS side).
This guide explains how to deploy a site-to-site VPN tunnel between AWS and Scaleway using Terraform, following best practices from the official guide.
- Access to an AWS and a Scaleway account
- Terraform installed
- Access to AWS and Scaleway credentials
- Fill in access variables in
scaleway.auto.tfvarsand AWS variables in your environment files. - Set the AWS VPC CIDR in
aws_plage(e.g.:10.1.0.0/16).
terraform init
terraform apply- This will create the VPC, private network, public gateway, Kapsule cluster, and VPN gateway on the Scaleway side.
- Make sure the
scw_vpn_public_ipvariable matches the public IP of the Scaleway gateway. - Run:
terraform init
terraform apply- This will create the VPC, subnets, customer gateway (pointing to Scaleway), VPN gateway, and VPN connection on the AWS side.
- After applying AWS, retrieve the outputs:
aws_vpn_tunnel1_address: AWS tunnel public IPaws_vpn_tunnel1_vgw_inside_address: AWS BGP IPaws_vpn_tunnel1_cgw_inside_address: Scaleway BGP IPaws_vpn_tunnel1_preshared_key: generated PSK (if not overridden)
-
In
main.tfon the Scaleway side, set:cgw_ip=aws_vpn_tunnel1_addressprivate_ip=aws_vpn_tunnel1_cgw_inside_address/30peer_private_ip=aws_vpn_tunnel1_vgw_inside_address/30
-
Apply the configuration:
terraform apply- After applying Scaleway, retrieve the PSK:
terraform output scw_vpn_psk- Pass the Scaleway PSK value to the
scw_vpn_pskvariable on AWS (via a.tfvarsfile or environment variable). - Re-run:
terraform apply- Check the VPN tunnel status in the AWS and Scaleway consoles.
- Test network connectivity between the two VPCs.
Notes:
- For each tunnel, repeat the steps with the values of the second tunnel.
- Adjust CIDR, ASN, and parameters according to your architecture.
- To automate output synchronization between the two stacks, use the
terraform_remote_stateprovider.