diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d93272e..15e780c 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -2,5 +2,5 @@ Hi! :wave: Thanks for the PR! Here's a quick checklist to make this PR easier to ##### PR Checklist - [ ] Have you run `terraform fmt` on the files in this repo? -- [ ] Have you updated the README.md by running `terraform-docs --sort-by-required markdown --header-from HEADER . > README.md`? +- [ ] Have you updated the README.md by running ` terraform-docs --sort-by-required markdown --header-from HEADER.md . > README.md`? --- \ No newline at end of file diff --git a/HEADER b/HEADER deleted file mode 100644 index f0b6c85..0000000 --- a/HEADER +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Overview of high-level configurations steps to set up HA VPN with Amazon Web Services (AWS): - * - * ![lifecycle: alpha](https://img.shields.io/badge/lifecycle-alpha-a0c3d2.svg) - * * Create the HA VPN gateway and a Cloud Router. This creates 2 public IP addresses on the GCP side. - * * Create two AWS Virtual Private Gateways. This creates 4 public addresses on the AWS side. - * * Create two AWS Site-to-Site VPN connections and customer gateways, one for each AWS Virtual Private Gateway. Specify a non-overlapping link-local Tunnel IP Range for each tunnel, 4 total. For example, 169.254.1.4/30. - * * Download the AWS configuration files for the generic device type. - * * Create four VPN tunnels on the HA VPN gateway. - * * Configure BGP sessions on the Cloud Router using the BGP IP addresses from the downloaded AWS configuration files. - * - * - * ### Single Region Example - * ```hcl - * module "tgw-us-east-1" { - * source = "terraform-aws-modules/transit-gateway/aws" - * version = "1.1.0" - * name = "tgw-example-us-east-1" - * description = "TGW example shared with several other AWS accounts" - * amazon_side_asn = "64512" - * - * enable_auto_accept_shared_attachments = true - * ram_allow_external_principals = true - * - * tags = { - * Purpose = "tgw example" - * } - * } - * - * module "cb-us-east-1" { - * source = "github.com/spotify/terraform-google-aws-hybrid-cloud-vpn" - * transit_gateway_id = module.tgw-us-east-1.this_ec2_transit_gateway_id - * google_network = default - * amazon_side_asn = 64512 - * google_side_asn = 65534 - * } - * ``` - * - * ### Refrence Docs - * https://cloud.google.com/files/CloudVPNGuide-UsingCloudVPNwithAmazonWebServices.pdf - * https://cloud.google.com/vpn/docs/how-to/creating-ha-vpn - */ - diff --git a/HEADER.md b/HEADER.md new file mode 100644 index 0000000..6b27ce1 --- /dev/null +++ b/HEADER.md @@ -0,0 +1,41 @@ +Overview of high-level configurations steps to set up HA VPN with Amazon Web Services (AWS): + +![lifecycle: alpha](https://img.shields.io/badge/lifecycle-alpha-a0c3d2.svg) +* Create the HA VPN gateway and a Cloud Router. This creates 2 public IP addresses on the GCP side. +* Create two AWS Virtual Private Gateways. This creates 4 public addresses on the AWS side. +* Create two AWS Site-to-Site VPN connections and customer gateways, one for each AWS Virtual Private Gateway. Specify a non-overlapping link-local Tunnel IP Range for each tunnel, 4 total. For example, 169.254.1.4/30. +* Download the AWS configuration files for the generic device type. +* Create four VPN tunnels on the HA VPN gateway. +* Configure BGP sessions on the Cloud Router using the BGP IP addresses from the downloaded AWS configuration files. + + +### Single Region Example +```hcl +module "tgw-us-east-1" { + source = "terraform-aws-modules/transit-gateway/aws" + version = "1.1.0" + name = "tgw-example-us-east-1" + description = "TGW example shared with several other AWS accounts" + amazon_side_asn = "64512" + + enable_auto_accept_shared_attachments = true + ram_allow_external_principals = true + + tags = { + Purpose = "tgw example" + } +} + +module "cb-us-east-1" { + source = "github.com/spotify/terraform-google-aws-hybrid-cloud-vpn" + transit_gateway_id = module.tgw-us-east-1.this_ec2_transit_gateway_id + google_network = default + amazon_side_asn = 64512 + google_side_asn = 65534 +} +``` + +### Refrence Docs +https://cloud.google.com/files/CloudVPNGuide-UsingCloudVPNwithAmazonWebServices.pdf +https://cloud.google.com/vpn/docs/how-to/creating-ha-vpn + diff --git a/README.md b/README.md index 480bcad..0c14b1b 100644 --- a/README.md +++ b/README.md @@ -23,15 +23,15 @@ module "tgw-us-east-1" { tags = { Purpose = "tgw example" } - } +} - module "cb-us-east-1" { - source = "github.com/spotify/terraform-google-aws-hybrid-cloud-vpn" - transit_gateway_id = module.tgw-us-east-1.this_ec2_transit_gateway_id - google_network = default - amazon_side_asn = 64512 - google_side_asn = 65534 - } +module "cb-us-east-1" { + source = "github.com/spotify/terraform-google-aws-hybrid-cloud-vpn" + transit_gateway_id = module.tgw-us-east-1.this_ec2_transit_gateway_id + google_network = default + amazon_side_asn = 64512 + google_side_asn = 65534 +} ``` ### Refrence Docs @@ -42,7 +42,7 @@ https://cloud.google.com/vpn/docs/how-to/creating-ha-vpn | Name | Version | |------|---------| -| aws | <4.0,>= 2.51.0 | +| aws | <4.0,>= 3.22.0 | | google | <4.0,>= 3.11.0 | | google-beta | <4.0,>= 3.11.0 | @@ -50,7 +50,7 @@ https://cloud.google.com/vpn/docs/how-to/creating-ha-vpn | Name | Version | |------|---------| -| aws | <4.0,>= 2.51.0 | +| aws | <4.0,>= 3.22.0 | | google | <4.0,>= 3.11.0 | | google-beta | <4.0,>= 3.11.0 | | random | n/a | @@ -72,4 +72,5 @@ https://cloud.google.com/vpn/docs/how-to/creating-ha-vpn |------|-------------| | cloud\_router | Map of cloud router attributes. Map should match the exported resources described in the docs https://www.terraform.io/docs/providers/google/r/compute_router.html | | ha\_vpn\_gateway\_interfaces | List of objects with interface ID and IP addresses | +| transit\_gateway\_attachment\_ids | Set of AWS Transit Gateway Attachement IDs | diff --git a/main.tf b/main.tf index 4900c86..b82dd4c 100644 --- a/main.tf +++ b/main.tf @@ -135,7 +135,7 @@ resource "google_compute_router" "router" { : var.router_advertise_config.groups ) ) - dynamic advertised_ip_ranges { + dynamic "advertised_ip_ranges" { for_each = ( var.router_advertise_config == null ? {} : ( var.router_advertise_config.mode != "CUSTOM" @@ -158,7 +158,7 @@ resource "google_compute_external_vpn_gateway" "external_gateway" { redundancy_type = "FOUR_IPS_REDUNDANCY" description = "AWS Transit GW: ${var.transit_gateway_id} in AWS region ${data.aws_region.current.name}" - dynamic interface { + dynamic "interface" { for_each = local.external_vpn_gateway_interfaces content { id = interface.key diff --git a/outputs.tf b/outputs.tf index 1088e42..14be3d8 100644 --- a/outputs.tf +++ b/outputs.tf @@ -20,4 +20,12 @@ output "ha_vpn_gateway_interfaces" { output "cloud_router" { value = google_compute_router.router description = "Map of cloud router attributes. Map should match the exported resources described in the docs https://www.terraform.io/docs/providers/google/r/compute_router.html" +} + +output "transit_gateway_attachment_ids" { + description = "Set of AWS Transit Gateway Attachement IDs" + value = toset([ + aws_vpn_connection.vpn-alpha.transit_gateway_attachment_id, + aws_vpn_connection.vpn-beta.transit_gateway_attachment_id + ]) } \ No newline at end of file diff --git a/versions.tf b/versions.tf index daf9b24..9543d1e 100644 --- a/versions.tf +++ b/versions.tf @@ -16,6 +16,6 @@ terraform { required_providers { google = "<4.0,>= 3.11.0" google-beta = "<4.0,>= 3.11.0" - aws = "<4.0,>= 2.51.0" + aws = "<4.0,>= 3.22.0" } }