{"id":13491213,"url":"https://github.com/terraform-google-modules/terraform-google-vpn","last_synced_at":"2025-11-09T08:30:32.296Z","repository":{"id":40339653,"uuid":"139579720","full_name":"terraform-google-modules/terraform-google-vpn","owner":"terraform-google-modules","description":"Sets up a Cloud VPN gateway","archived":false,"fork":false,"pushed_at":"2024-12-19T02:12:51.000Z","size":360,"stargazers_count":90,"open_issues_count":3,"forks_count":93,"subscribers_count":28,"default_branch":"master","last_synced_at":"2024-12-28T07:18:05.950Z","etag":null,"topics":["cft-terraform","networking"],"latest_commit_sha":null,"homepage":"https://registry.terraform.io/modules/terraform-google-modules/vpn/google","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terraform-google-modules.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-03T12:24:10.000Z","updated_at":"2024-11-13T14:36:50.000Z","dependencies_parsed_at":"2023-01-31T09:16:01.363Z","dependency_job_id":"c118df92-098b-4566-a292-cfa9fb9f6d91","html_url":"https://github.com/terraform-google-modules/terraform-google-vpn","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-google-modules%2Fterraform-google-vpn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-google-modules%2Fterraform-google-vpn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-google-modules%2Fterraform-google-vpn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-google-modules%2Fterraform-google-vpn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terraform-google-modules","download_url":"https://codeload.github.com/terraform-google-modules/terraform-google-vpn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239571542,"owners_count":19661164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cft-terraform","networking"],"created_at":"2024-07-31T19:00:54.600Z","updated_at":"2025-11-09T08:30:32.262Z","avatar_url":"https://github.com/terraform-google-modules.png","language":"HCL","funding_links":[],"categories":["HCL"],"sub_categories":[],"readme":"# Terraform Google Cloud Platform - [VPN Module](https://registry.terraform.io/modules/terraform-google-modules/vpn/google)\n\nThis modules makes it easy to set up VPN connectivity in GCP by defining your gateways and tunnels in a concise syntax.\n\nIt supports creating:\n\n- A Google VPN Gateway\n- Tunnels connecting the gateway to defined peers\n- Static routes for subnets across tunnel -or- dynamic routes with cloud router\n\nIf you want to deploy [HA VPN](https://cloud.google.com/vpn/docs/how-to/moving-to-ha-vpn) please refer to the [VPN HA Submodule](./modules/vpn_ha/)\n\n## Compatibility\n\n This module is meant for use with Terraform 1.3+. If you haven't [upgraded](https://developer.hashicorp.com/terraform/language/v1.3.x/upgrade-guides)\n  and need a Terraform 0.11.x-compatible version of this module, the last released version intended for\n  Terraform 0.11.x is [0.3.0](https://registry.terraform.io/modules/terraform-google-modules/vpn/google/0.3.0).\n\n## Upgrading\n\nThe following guides are available to assist with upgrades:\n\n- [1.X -\u003e 2.0](./docs/upgrading_to_vpn_v2.0.md)\n- [2.X -\u003e 3.0](./docs/upgrading_to_vpn_v3.0.md)\n\n## Usage\n\nYou can go to the examples folder, however the usage of the module could be like this in your own main.tf file:\n\n```hcl\nresource \"google_compute_router\" \"cr-uscentral1-to-prod-vpc\" {\n  name    = \"cr-uscentral1-to-prod-vpc-tunnels\"\n  region  = \"us-central1\"\n  network = \"default\"\n  project = var.project_id\n\n  bgp {\n    asn = \"64519\"\n  }\n}\n\nmodule \"vpn-prod-internal\" {\n  source  = \"terraform-google-modules/vpn/google\"\n  version = \"~\u003e 1.2.0\"\n\n  project_id         = var.project_id\n  network            = \"default\"\n  region             = \"us-west1\"\n  gateway_name       = \"vpn-prod-internal\"\n  tunnel_name_prefix = \"vpn-tn-prod-internal\"\n  shared_secret      = \"secrets\"\n  tunnel_count       = 1\n  peer_ips           = [\"1.1.1.1\", \"2.2.2.2\"]\n\n  route_priority = 1000\n  remote_subnet  = [\"10.17.0.0/22\", \"10.16.80.0/24\"]\n}\n\nmodule \"vpn-manage-internal\" {\n  source  = \"terraform-google-modules/vpn/google\"\n  version = \"~\u003e 1.2.0\"\n  project_id         = var.project_id\n  network            = \"default\"\n  region             = \"us-west1\"\n  gateway_name       = \"vpn-manage-internal\"\n  tunnel_name_prefix = \"vpn-tn-manage-internal\"\n  shared_secret      = \"secrets\"\n  tunnel_count       = 1\n  peer_ips           = [\"1.1.1.1\", \"2.2.2.2\"]\n\n  route_priority = 1000\n  remote_subnet  = [\"10.17.32.0/20\", \"10.17.16.0/20\"]\n}\n```\n\nThen perform the following commands on the root folder:\n\n- `terraform init` to get the plugins\n- `terraform plan` to see the infrastructure plan\n- `terraform apply` to apply the infrastructure build\n- `terraform destroy` to destroy the built infrastructure\n\n## Static vs Dynamic\nDepending on if the VPN tunnel(s) will be using dynamic or static routing,\ndifferent variables will need to be used in the module.\nReferences the variable descriptions below to determine the right configuration.\n\n\u003c!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| advertised\\_route\\_priority | Please enter the priority for the advertised route to BGP peer(default is 100) | `number` | `100` | no |\n| bgp\\_cr\\_session\\_range | Please enter the cloud-router interface IP/Session IP | `list(string)` | \u003cpre\u003e[\u003cbr\u003e  \"169.254.1.1/30\",\u003cbr\u003e  \"169.254.1.5/30\"\u003cbr\u003e]\u003c/pre\u003e | no |\n| bgp\\_remote\\_session\\_range | Please enter the remote environments BGP Session IP | `list(string)` | \u003cpre\u003e[\u003cbr\u003e  \"169.254.1.2\",\u003cbr\u003e  \"169.254.1.6\"\u003cbr\u003e]\u003c/pre\u003e | no |\n| cr\\_enabled | If there is a cloud router for BGP routing | `bool` | `false` | no |\n| cr\\_name | The name of cloud router for BGP routing | `string` | `\"\"` | no |\n| gateway\\_name | The name of VPN gateway | `string` | `\"test-vpn\"` | no |\n| ike\\_version | Please enter the IKE version used by this tunnel (default is IKEv2) | `number` | `2` | no |\n| ipsec\\_secret\\_length | The lnegth the of shared secret for VPN tunnels | `number` | `8` | no |\n| local\\_traffic\\_selector | Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway.\u003cbr\u003eValue should be list of CIDR formatted strings and ranges should be disjoint. | `list(string)` | \u003cpre\u003e[\u003cbr\u003e  \"0.0.0.0/0\"\u003cbr\u003e]\u003c/pre\u003e | no |\n| network | The name of VPC being created | `string` | n/a | yes |\n| peer\\_asn | Please enter the ASN of the BGP peer that cloud router will use | `list(string)` | \u003cpre\u003e[\u003cbr\u003e  \"65101\"\u003cbr\u003e]\u003c/pre\u003e | no |\n| peer\\_ips | IP address of remote-peer/gateway | `list(string)` | n/a | yes |\n| project\\_id | The ID of the project where this VPC will be created | `string` | n/a | yes |\n| region | The region in which you want to create the VPN gateway | `string` | n/a | yes |\n| remote\\_subnet | remote subnet ip range in CIDR format - x.x.x.x/x | `list(string)` | `[]` | no |\n| remote\\_traffic\\_selector | Remote traffic selector to use when establishing the VPN tunnel with peer VPN gateway.\u003cbr\u003eValue should be list of CIDR formatted strings and ranges should be disjoint. | `list(string)` | \u003cpre\u003e[\u003cbr\u003e  \"0.0.0.0/0\"\u003cbr\u003e]\u003c/pre\u003e | no |\n| route\\_priority | Priority for static route being created | `number` | `1000` | no |\n| route\\_tags | A list of instance tags to which this route applies. | `list(string)` | `[]` | no |\n| shared\\_secret | Please enter the shared secret/pre-shared key | `string` | `\"\"` | no |\n| tunnel\\_count | The number of tunnels from each VPN gw (default is 1) | `number` | `1` | no |\n| tunnel\\_name\\_prefix | The optional custom name of VPN tunnel being created | `string` | `\"\"` | no |\n| vpn\\_gw\\_ip | Please enter the public IP address of the VPN Gateway, if you have already one. Do not set this variable to autocreate one | `string` | `\"\"` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| gateway\\_ip | The VPN Gateway Public IP |\n| gateway\\_self\\_link | The self-link of the Gateway |\n| ipsec\\_secret-dynamic | The secret |\n| ipsec\\_secret-static | The secret |\n| name | The name of the Gateway |\n| network | The name of the VPC |\n| project\\_id | The Project-ID |\n| vpn\\_tunnels\\_names-dynamic | The VPN tunnel name is |\n| vpn\\_tunnels\\_names-static | The VPN tunnel name is |\n| vpn\\_tunnels\\_self\\_link-dynamic | The VPN tunnel self-link is |\n| vpn\\_tunnels\\_self\\_link-static | The VPN tunnel self-link is |\n\n\u003c!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n\n## Requirements\n### Terraform plugins\n- [Terraform](https://www.terraform.io/downloads.html) 1.3+\n- [terraform-provider-google](https://github.com/terraform-providers/terraform-provider-google) plugin v4.64+\n\n### Configure a Service Account\nIn order to execute this module you must have a Service Account with the following roles:\n- roles/compute.networkAdmin on the organization\n\n### Enable API's\nIn order to operate with the Service Account you must activate the following API on the project where the Service Account was created:\n- Compute Engine API - compute.googleapis.com\n\n## Development\n### File structure\nThe project has the following folders and files:\n\n- /: root folder\n- /examples: examples for using this module\n- /main.tf: main file for this module, contains the routing resources\n- /gateway.tf: contains the gateway resources\n- /tunnel.tf: contains the tunnel resources\n- /forwarding-rule.tf: contains the forwarding rules\n- /variables.tf: all the variables for the module\n- /output.tf: the outputs of the module\n- /modules/vpn_ha/: vpn ha submodule\n- /README.md: this file\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterraform-google-modules%2Fterraform-google-vpn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterraform-google-modules%2Fterraform-google-vpn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterraform-google-modules%2Fterraform-google-vpn/lists"}