diff options
-rw-r--r-- | resources/tools/terraform/aws/main.tf | 44 | ||||
-rw-r--r-- | resources/tools/terraform/aws/nic.tf | 40 |
2 files changed, 34 insertions, 50 deletions
diff --git a/resources/tools/terraform/aws/main.tf b/resources/tools/terraform/aws/main.tf index 74baa12419..49ef73e17f 100644 --- a/resources/tools/terraform/aws/main.tf +++ b/resources/tools/terraform/aws/main.tf @@ -35,22 +35,6 @@ variable "trex_dummy_cidr_port_1" { } # IPs -variable "a_gateway" { - type = string - default = "192.168.0.1" -} -variable "b_gateway" { - type = string - default = "192.168.10.1" -} -variable "c_gateway" { - type = string - default = "200.0.0.1" -} -variable "d_gateway" { - type = string - default = "192.168.20.1" -} variable "tg_if1_ip" { type = string default = "192.168.10.254" @@ -100,7 +84,7 @@ resource "aws_vpc" "CSIT" { resource "aws_security_group" "CSIT" { name = "CSIT" - description = "Allow inbound traffic" + description = "Allow inbound traffic" vpc_id = aws_vpc.CSIT.id ingress { @@ -118,27 +102,27 @@ resource "aws_security_group" "CSIT" { } egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] } depends_on = [aws_vpc.CSIT] } resource "aws_vpc_ipv4_cidr_block_association" "b" { - vpc_id = aws_vpc.CSIT.id + vpc_id = aws_vpc.CSIT.id cidr_block = var.vpc_cidr_b depends_on = [aws_vpc.CSIT] } resource "aws_vpc_ipv4_cidr_block_association" "c" { - vpc_id = aws_vpc.CSIT.id + vpc_id = aws_vpc.CSIT.id cidr_block = var.vpc_cidr_c depends_on = [aws_vpc.CSIT] } resource "aws_vpc_ipv4_cidr_block_association" "d" { - vpc_id = aws_vpc.CSIT.id + vpc_id = aws_vpc.CSIT.id cidr_block = var.vpc_cidr_d depends_on = [aws_vpc.CSIT] } @@ -185,12 +169,12 @@ data "aws_ami" "ubuntu" { most_recent = true filter { - name = "name" + name = "name" values = ["*hvm-ssd/ubuntu-bionic-18.04-amd64*"] } filter { - name = "virtualization-type" + name = "virtualization-type" values = ["hvm"] } @@ -198,12 +182,12 @@ data "aws_ami" "ubuntu" { } resource "aws_placement_group" "CSIT" { - name = "CSIT" + name = "CSIT" strategy = "cluster" } resource "aws_instance" "tg" { - ami = data.aws_ami.ubuntu.id + ami = data.aws_ami.ubuntu.id instance_type = var.instance_type # cpu_threads_per_core = 1 # cpu_core_count = 18 @@ -218,7 +202,7 @@ resource "aws_instance" "tg" { } resource "aws_instance" "dut1" { - ami = data.aws_ami.ubuntu.id + ami = data.aws_ami.ubuntu.id # cpu_threads_per_core = 1 # cpu_core_count = 18 instance_type = var.instance_type @@ -233,7 +217,7 @@ resource "aws_instance" "dut1" { } resource "aws_instance" "dut2" { - ami = data.aws_ami.ubuntu.id + ami = data.aws_ami.ubuntu.id # cpu_threads_per_core = 1 # cpu_core_count = 18 instance_type = var.instance_type diff --git a/resources/tools/terraform/aws/nic.tf b/resources/tools/terraform/aws/nic.tf index 31926e4abd..3efd74fc14 100644 --- a/resources/tools/terraform/aws/nic.tf +++ b/resources/tools/terraform/aws/nic.tf @@ -1,35 +1,35 @@ -resource "aws_network_interface" "dut1_if2" { - subnet_id = aws_subnet.c.id +resource "aws_network_interface" "dut1_if1" { + subnet_id = aws_subnet.b.id source_dest_check = false - private_ip = var.dut1_if2_ip - private_ips = [var.dut1_if2_ip] + private_ip = var.dut1_if1_ip + private_ips = [var.dut1_if1_ip] security_groups = [aws_security_group.CSIT.id] attachment { - instance = aws_instance.dut1.id + instance = aws_instance.dut1.id device_index = 1 } - depends_on = [aws_vpc.CSIT] + depends_on = [aws_vpc.CSIT, aws_subnet.b] } -data "aws_network_interface" "dut1_if2" { - id = aws_network_interface.dut1_if2.id +data "aws_network_interface" "dut1_if1" { + id = aws_network_interface.dut1_if1.id } -resource "aws_network_interface" "dut1_if1" { - subnet_id = aws_subnet.b.id +resource "aws_network_interface" "dut1_if2" { + subnet_id = aws_subnet.c.id source_dest_check = false - private_ip = var.dut1_if1_ip - private_ips = [var.dut1_if1_ip] + private_ip = var.dut1_if2_ip + private_ips = [var.dut1_if2_ip] security_groups = [aws_security_group.CSIT.id] attachment { - instance = aws_instance.dut1.id + instance = aws_instance.dut1.id device_index = 2 } - depends_on = [aws_vpc.CSIT, aws_subnet.b] + depends_on = [aws_vpc.CSIT] } -data "aws_network_interface" "dut1_if1" { - id = aws_network_interface.dut1_if1.id +data "aws_network_interface" "dut1_if2" { + id = aws_network_interface.dut1_if2.id } resource "aws_network_interface" "dut2_if1" { @@ -39,7 +39,7 @@ resource "aws_network_interface" "dut2_if1" { private_ips = [var.dut2_if1_ip] security_groups = [aws_security_group.CSIT.id] attachment { - instance = aws_instance.dut2.id + instance = aws_instance.dut2.id device_index = 1 } depends_on = [aws_vpc.CSIT, aws_subnet.c] @@ -56,7 +56,7 @@ resource "aws_network_interface" "dut2_if2" { private_ips = [var.dut2_if2_ip] security_groups = [aws_security_group.CSIT.id] attachment { - instance = aws_instance.dut2.id + instance = aws_instance.dut2.id device_index = 2 } depends_on = [aws_vpc.CSIT, aws_subnet.d] @@ -73,7 +73,7 @@ resource "aws_network_interface" "tg_if1" { private_ips = [var.tg_if1_ip] security_groups = [aws_security_group.CSIT.id] attachment { - instance = aws_instance.tg.id + instance = aws_instance.tg.id device_index = 1 } depends_on = [aws_vpc.CSIT, aws_subnet.b] @@ -90,7 +90,7 @@ resource "aws_network_interface" "tg_if2" { private_ips = [var.tg_if2_ip] security_groups = [aws_security_group.CSIT.id] attachment { - instance = aws_instance.tg.id + instance = aws_instance.tg.id device_index = 2 } depends_on = [aws_vpc.CSIT, aws_subnet.d] |