diff options
author | Peter Mikus <pmikus@cisco.com> | 2022-03-24 14:13:32 +0100 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2022-03-25 08:17:41 +0000 |
commit | 0deec65be1ef39f37090f2b5b851eb4b34c116f9 (patch) | |
tree | 409feeeb125116ba60f0eea3f9c872f98e9e23ea /fdio.infra.terraform/terraform-aws-vpc/main.tf | |
parent | c5181ae1627fed20b79a829bf2330f3ee9d8a0f6 (diff) |
feat(terraform): AWS Subnet
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Change-Id: I11d10c4c734354f112a7b6bf4a8f3c0febfc0862
Diffstat (limited to 'fdio.infra.terraform/terraform-aws-vpc/main.tf')
-rw-r--r-- | fdio.infra.terraform/terraform-aws-vpc/main.tf | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/fdio.infra.terraform/terraform-aws-vpc/main.tf b/fdio.infra.terraform/terraform-aws-vpc/main.tf index ed2e8715e7..59ac63663d 100644 --- a/fdio.infra.terraform/terraform-aws-vpc/main.tf +++ b/fdio.infra.terraform/terraform-aws-vpc/main.tf @@ -15,7 +15,7 @@ resource "aws_vpc" "vpc" { tags = local.tags } -# Create Security Groups +# Create Security Group resource "aws_security_group" "security_group" { depends_on = [ aws_vpc.vpc @@ -29,26 +29,26 @@ resource "aws_security_group" "security_group" { dynamic "ingress" { for_each = var.security_group_ingress content { - from_port = ingress.value["from_port"] - to_port = ingress.value["to_port"] - protocol = ingress.value["protocol"] - cidr_blocks = ingress.value["cidr_blocks"] - ipv6_cidr_blocks = ingress.value["ipv6_cidr_blocks"] + from_port = lookup(ingress.value, "from_port", null) + to_port = lookup(ingress.value, "to_port", null) + protocol = lookup(ingress.value, "protocol", null) + cidr_blocks = lookup(ingress.value, "cidr_blocks", null) + ipv6_cidr_blocks = lookup(ingress.value, "ipv6_cidr_blocks", null) } } dynamic "egress" { for_each = var.security_group_egress content { - from_port = ingress.value["from_port"] - to_port = ingress.value["to_port"] - protocol = ingress.value["protocol"] - cidr_blocks = ingress.value["cidr_blocks"] - ipv6_cidr_blocks = ingress.value["ipv6_cidr_blocks"] + from_port = lookup(ingress.value, "from_port", null) + to_port = lookup(ingress.value, "to_port", null) + protocol = lookup(ingress.value, "protocol", null) + cidr_blocks = lookup(ingress.value, "cidr_blocks", null) + ipv6_cidr_blocks = lookup(ingress.value, "ipv6_cidr_blocks", null) } } } -# Create Gateway +# Create Internet Gateway resource "aws_internet_gateway" "internet_gateway" { depends_on = [ aws_vpc.vpc @@ -57,18 +57,18 @@ resource "aws_internet_gateway" "internet_gateway" { vpc_id = aws_vpc.vpc.id } -# Create Routes +# Create Route resource "aws_route" "route" { depends_on = [ aws_vpc.vpc, aws_internet_gateway.internet_gateway ] - destination_cidr_block = "0.0.0.0/0" - gateway_id = aws_internet_gateway.internet_gateway.id - route_table_id = aws_vpc.vpc.main_route_table_id + destination_cidr_block = "0.0.0.0/0" + gateway_id = aws_internet_gateway.internet_gateway.id + route_table_id = aws_vpc.vpc.main_route_table_id } -# Create Subnets +# Create Subnet resource "aws_subnet" "subnet" { depends_on = [ aws_vpc.vpc |