Skip to content

Commit

Permalink
update README, vpc.tf for attaching to tgw
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Dec 16, 2022
1 parent ee67e6d commit e7c4b62
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
10 changes: 10 additions & 0 deletions examples/full-setup-tf-upgrade/tgw/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ Make sure the VPC directory contains these two files:
* outputs.routing.tf
* variables.tgw_environment.tf

Also, copy an updated `vpc.tf` into the main VPC directory (same location as the two files above). This is because
we need to remove the attachment subnet association to the main private route table.

Also, you will need to be sure the attachment subnets have the proper tag: In `variables.subnets.auto.tfvars`, update
th attachment subnet block to add a tag of `"boc:vpc:route-table" = "attachment"` as shown in the example:

```hcl
{ base_cidr = "10.192.1.128/25", label = "attachment", bits = 2, private = true, enabled = true, tags = { "boc:vpc:route-table" = "attachment" } },
```

You will need to do a `tf-apply` to add the new outputs to remote state.

## FIles in VPC/tgw directory
Expand Down
12 changes: 8 additions & 4 deletions examples/full-setup-tf-upgrade/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ module "vpc" {
vpc_ntp_servers = var.vpc_ntp_servers
enable_aws_dns = var.vpc_enable_awsdns

tags = local.tags
tags = merge(
local.tags,
tomap({ "boc:tgw_environment" = var.tgw_environment }),
)
}

module "subnets" {
Expand All @@ -39,9 +42,10 @@ module "routing" {
source = "git@github.e.it.census.gov:terraform-modules/aws-vpc-setup.git//routing?ref=tf-upgrade"
vpc_id = local.vpc_id

vpc_full_name = var.vpc_full_name
availability_zones = []
private_subnets_ids = module.subnets.private_subnets_ids
vpc_full_name = var.vpc_full_name
availability_zones = []
# private_subnets_ids = module.subnets.private_subnets_ids
private_subnets_ids = [for sn in module.subnets.private_subnets_ids : sn if lookup(sn.tags, "boc:vpc:route-table", null) != "attachment"]
public_subnets_ids = module.subnets.public_subnets_ids
enable_igw = var.vpc_enable_igw
enable_nat = var.vpc_enable_nat
Expand Down

0 comments on commit e7c4b62

Please sign in to comment.