diff --git a/terraform/aws/new-natgw/main.tf b/terraform/aws/new-natgw/main.tf new file mode 100644 index 0000000..3a39273 --- /dev/null +++ b/terraform/aws/new-natgw/main.tf @@ -0,0 +1,20 @@ +// Create a Elastic IP for NAT GW +resource "aws_eip" "demo_gw_eip" { + vpc = true + tags = { + tool = "terraform" + } +} + +// Create a NAT GW in public1 and public2 subnets +resource "aws_nat_gateway" "ease_prod_vpc_nat_gws" { + count = length(var.ease_prod_vpc_public_subnets) + allocation_id = aws_eip.demo_gw_eip.id + # feed coreos_subnet public subnet ID + subnet_id = var.coreos_subnet_id + + tags = { + tool = "terraform" + } + depends_on = [aws_eip.demo_gw_eip] +} \ No newline at end of file diff --git a/terraform/aws/new-natgw/variables.tf b/terraform/aws/new-natgw/variables.tf new file mode 100644 index 0000000..0ed2833 --- /dev/null +++ b/terraform/aws/new-natgw/variables.tf @@ -0,0 +1,6 @@ +// note: this variable will be fed with coreos_subnet subnet ID which can be found at terraform/aws/new-vpc/main.tf +variable "coreos_subnet_id" { + type = "string" + default = "" + description = "AWS coreos_vpc subnet ID" +} \ No newline at end of file