X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=fdio.infra.terraform%2F3n_aws_c5n%2Fdeploy%2Fmain.tf;h=188b095b553d2a5067d48252a048fcd8ff2016ae;hp=05c7e32862781ecf51c88347f4b06e00d00336f0;hb=02c349c4c2fa7fb1b43b04c2511d3a9ac77bfefd;hpb=be8405772f59e38bfc57ff985e459ac9bb0802be diff --git a/fdio.infra.terraform/3n_aws_c5n/deploy/main.tf b/fdio.infra.terraform/3n_aws_c5n/deploy/main.tf index 05c7e32862..188b095b55 100644 --- a/fdio.infra.terraform/3n_aws_c5n/deploy/main.tf +++ b/fdio.infra.terraform/3n_aws_c5n/deploy/main.tf @@ -4,7 +4,7 @@ data "vault_aws_access_credentials" "creds" { } resource "aws_vpc" "CSITVPC" { - assign_generated_ipv6_cidr_block = false + assign_generated_ipv6_cidr_block = true enable_dns_hostnames = false enable_dns_support = true cidr_block = var.vpc_cidr_mgmt @@ -30,7 +30,13 @@ resource "aws_security_group" "CSITSG" { to_port = 22 protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] - ipv6_cidr_blocks = [] + } + + ingress { + from_port = 22 + to_port = 22 + protocol = "tcp" + ipv6_cidr_blocks = ["::/0"] } ingress { @@ -38,7 +44,7 @@ resource "aws_security_group" "CSITSG" { to_port = 0 protocol = -1 self = true - ipv6_cidr_blocks = [] + ipv6_cidr_blocks = ["::/0"] } egress { @@ -46,7 +52,13 @@ resource "aws_security_group" "CSITSG" { to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] - ipv6_cidr_blocks = [] + } + + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + ipv6_cidr_blocks = ["::/0"] } tags = { @@ -87,6 +99,7 @@ resource "aws_subnet" "mgmt" { depends_on = [ aws_vpc.CSITVPC ] + ipv6_cidr_block = cidrsubnet(aws_vpc.CSITVPC.ipv6_cidr_block, 8, 1) map_public_ip_on_launch = false vpc_id = aws_vpc.CSITVPC.id @@ -103,6 +116,7 @@ resource "aws_subnet" "b" { aws_vpc.CSITVPC, aws_vpc_ipv4_cidr_block_association.b ] + ipv6_cidr_block = cidrsubnet(aws_vpc.CSITVPC.ipv6_cidr_block, 8, 2) map_public_ip_on_launch = false vpc_id = aws_vpc.CSITVPC.id @@ -119,6 +133,7 @@ resource "aws_subnet" "c" { aws_vpc.CSITVPC, aws_vpc_ipv4_cidr_block_association.c ] + ipv6_cidr_block = cidrsubnet(aws_vpc.CSITVPC.ipv6_cidr_block, 8, 3) map_public_ip_on_launch = false vpc_id = aws_vpc.CSITVPC.id @@ -127,17 +142,6 @@ resource "aws_subnet" "c" { } } -resource "aws_subnet" "d" { - vpc_id = aws_vpc.CSITVPC.id - cidr_block = var.vpc_cidr_d - availability_zone = var.avail_zone - depends_on = [aws_vpc.CSITVPC, aws_vpc_ipv4_cidr_block_association.d] - - tags = { - "Environment" = var.environment_name - } -} - resource "aws_subnet" "d" { availability_zone = var.avail_zone assign_ipv6_address_on_creation = false @@ -146,6 +150,7 @@ resource "aws_subnet" "d" { aws_vpc.CSITVPC, aws_vpc_ipv4_cidr_block_association.d ] + ipv6_cidr_block = cidrsubnet(aws_vpc.CSITVPC.ipv6_cidr_block, 8, 4) map_public_ip_on_launch = false vpc_id = aws_vpc.CSITVPC.id @@ -154,6 +159,17 @@ resource "aws_subnet" "d" { } } +resource "aws_internet_gateway" "CSITGW" { + depends_on = [ + aws_vpc.CSITVPC + ] + vpc_id = aws_vpc.CSITVPC.id + + tags = { + "Environment" = var.environment_name + } +} + # SSH keypair # Temporary key for provisioning only resource "tls_private_key" "CSITTLS" { @@ -223,15 +239,15 @@ resource "aws_network_interface" "dut2_if1" { aws_subnet.c, aws_instance.dut2 ] - private_ip = var.dut2_if2_ip - private_ips = [var.dut2_if2_ip] + private_ip = var.dut2_if1_ip + private_ips = [var.dut2_if1_ip] security_groups = [aws_security_group.CSITSG.id] source_dest_check = false subnet_id = aws_subnet.c.id attachment { instance = aws_instance.dut2.id - device_index = 2 + device_index = 1 } tags = { @@ -424,9 +440,10 @@ resource "aws_route" "CSIT-igw" { aws_vpc.CSITVPC, aws_internet_gateway.CSITGW ] - destination_cidr_block = "0.0.0.0/0" - gateway_id = aws_internet_gateway.CSITGW.id - route_table_id = aws_vpc.CSITVPC.main_route_table_id + destination_cidr_block = "0.0.0.0/0" + destination_ipv6_cidr_block = "::/0" + gateway_id = aws_internet_gateway.CSITGW.id + route_table_id = aws_vpc.CSITVPC.main_route_table_id } resource "aws_route" "dummy-trex-port-0" {