added NAT GW resource

This commit is contained in:
UdhavPawar 2021-09-16 14:09:12 -07:00
parent 8d7cf1304b
commit b6e221fe77
2 changed files with 26 additions and 0 deletions

View file

@ -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]
}

View file

@ -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"
}