diff options
author | Maros Mullner <maros.mullner@pantheon.tech> | 2020-05-22 08:27:07 +0200 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2020-05-27 13:11:10 +0000 |
commit | 5d4c299d02072fd18ef175bfbf7c694e94db79a6 (patch) | |
tree | 2c68868b5fd42a86197aeae205557a435f4eef16 /resources/tools/terraform | |
parent | 3ea4fcebabfaac866d469a7b4355ac8df7732a0f (diff) |
Terraform and ansible changes for Cloud environment (AWS, Azure).
Signed-off-by: Maros Mullner <maros.mullner@pantheon.tech>
Change-Id: Ic78b5dae22b67763b99c50a5f15d7dd16152d5d5
Diffstat (limited to 'resources/tools/terraform')
-rw-r--r-- | resources/tools/terraform/aws/main.tf | 9 | ||||
-rw-r--r-- | resources/tools/terraform/azure/main.tf | 69 | ||||
-rw-r--r-- | resources/tools/terraform/azure/nic.tf | 12 |
3 files changed, 54 insertions, 36 deletions
diff --git a/resources/tools/terraform/aws/main.tf b/resources/tools/terraform/aws/main.tf index 49ef73e17f..edb179990a 100644 --- a/resources/tools/terraform/aws/main.tf +++ b/resources/tools/terraform/aws/main.tf @@ -194,6 +194,9 @@ resource "aws_instance" "tg" { key_name = aws_key_pair.CSIT.key_name associate_public_ip_address = true subnet_id = aws_subnet.mgmt.id + root_block_device { + volume_size = 50 + } private_ip = var.tg_mgmt_ip vpc_security_group_ids = [aws_security_group.CSIT.id] depends_on = [aws_vpc.CSIT, aws_placement_group.CSIT] @@ -209,6 +212,9 @@ resource "aws_instance" "dut1" { key_name = aws_key_pair.CSIT.key_name associate_public_ip_address = true subnet_id = aws_subnet.mgmt.id + root_block_device { + volume_size = 50 + } private_ip = var.dut1_mgmt_ip vpc_security_group_ids = [aws_security_group.CSIT.id] depends_on = [aws_vpc.CSIT, aws_placement_group.CSIT] @@ -224,6 +230,9 @@ resource "aws_instance" "dut2" { key_name = aws_key_pair.CSIT.key_name associate_public_ip_address = true subnet_id = aws_subnet.mgmt.id + root_block_device { + volume_size = 50 + } private_ip = var.dut2_mgmt_ip vpc_security_group_ids = [aws_security_group.CSIT.id] depends_on = [aws_vpc.CSIT, aws_placement_group.CSIT] diff --git a/resources/tools/terraform/azure/main.tf b/resources/tools/terraform/azure/main.tf index 96b8065d5a..89f1905800 100644 --- a/resources/tools/terraform/azure/main.tf +++ b/resources/tools/terraform/azure/main.tf @@ -4,6 +4,11 @@ provider "azurerm" { # Variables +variable "vpc_addr_space_a" { + type = string + default = "172.16.0.0/16" +} + variable "vpc_cidr_a" { type = string default = "172.16.0.0/24" @@ -11,44 +16,42 @@ variable "vpc_cidr_a" { variable "vpc_cidr_b" { type = string - default = "192.168.10.0/24" + default = "172.16.10.0/24" } variable "vpc_cidr_c" { type = string - default = "200.0.0.0/24" + default = "172.16.200.0/24" } variable "vpc_cidr_d" { type = string - default = "192.168.20.0/24" + default = "172.16.20.0/24" } variable "trex_dummy_cidr_port_0" { type = string - default = "10.0.0.0/24" + default = "172.16.11.0/24" } variable "trex_dummy_cidr_port_1" { type = string - default = "20.0.0.0/24" + default = "172.16.21.0/24" } # Create resource group and resources resource "azurerm_resource_group" "CSIT" { name = "CSIT" - location = "East US" + #location = "East US" + location = "UK South" } resource "azurerm_virtual_network" "CSIT" { name = "CSIT-network" resource_group_name = azurerm_resource_group.CSIT.name location = azurerm_resource_group.CSIT.location - address_space = [ var.vpc_cidr_a, - var.vpc_cidr_b, - var.vpc_cidr_c, - var.vpc_cidr_d ] + address_space = [ var.vpc_addr_space_a ] depends_on = [ azurerm_resource_group.CSIT ] } @@ -239,21 +242,21 @@ resource "azurerm_route_table" "b" { disable_bgp_route_propagation = false route { name = "route-10" - address_prefix = "10.0.0.0/24" + address_prefix = var.trex_dummy_cidr_port_0 next_hop_type = "VirtualAppliance" - next_hop_in_ip_address = "192.168.10.254" + next_hop_in_ip_address = data.azurerm_network_interface.tg_if1.private_ip_address } route { name = "route-20" - address_prefix = "20.0.0.0/24" + address_prefix = var.trex_dummy_cidr_port_1 next_hop_type = "VirtualAppliance" - next_hop_in_ip_address = "192.168.10.11" + next_hop_in_ip_address = data.azurerm_network_interface.dut1_if1.private_ip_address } route { name = "tg2" - address_prefix = "192.168.20.0/24" + address_prefix = var.vpc_cidr_d next_hop_type = "VirtualAppliance" - next_hop_in_ip_address = "192.168.10.11" + next_hop_in_ip_address = data.azurerm_network_interface.dut1_if1.private_ip_address } } @@ -266,27 +269,33 @@ resource "azurerm_route_table" "c" { disable_bgp_route_propagation = false route { name = "route-10" - address_prefix = "10.0.0.0/24" + address_prefix = var.trex_dummy_cidr_port_0 + next_hop_type = "VirtualAppliance" + next_hop_in_ip_address = data.azurerm_network_interface.dut1_if2.private_ip_address + } + route { + name = "route-100" + address_prefix = "100.0.0.0/8" next_hop_type = "VirtualAppliance" - next_hop_in_ip_address = "200.0.0.101" + next_hop_in_ip_address = data.azurerm_network_interface.dut1_if2.private_ip_address } route { name = "route-20" - address_prefix = "20.0.0.0/24" + address_prefix = var.trex_dummy_cidr_port_1 next_hop_type = "VirtualAppliance" - next_hop_in_ip_address = "200.0.0.102" + next_hop_in_ip_address = data.azurerm_network_interface.dut2_if1.private_ip_address } route { name = "tg1" - address_prefix = "192.168.10.0/24" + address_prefix = var.vpc_cidr_b next_hop_type = "VirtualAppliance" - next_hop_in_ip_address = "200.0.0.101" + next_hop_in_ip_address = data.azurerm_network_interface.dut1_if2.private_ip_address } route { name = "tg2" - address_prefix = "192.168.20.0/24" + address_prefix = var.vpc_cidr_d next_hop_type = "VirtualAppliance" - next_hop_in_ip_address = "200.0.0.102" + next_hop_in_ip_address = data.azurerm_network_interface.dut2_if1.private_ip_address } } @@ -299,21 +308,21 @@ resource "azurerm_route_table" "d" { disable_bgp_route_propagation = false route { name = "route-10" - address_prefix = "10.0.0.0/24" + address_prefix = var.trex_dummy_cidr_port_0 next_hop_type = "VirtualAppliance" - next_hop_in_ip_address = "192.168.20.11" + next_hop_in_ip_address = data.azurerm_network_interface.dut2_if2.private_ip_address } route { name = "route-20" - address_prefix = "20.0.0.0/24" + address_prefix = var.trex_dummy_cidr_port_1 next_hop_type = "VirtualAppliance" - next_hop_in_ip_address = "192.168.20.254" + next_hop_in_ip_address = data.azurerm_network_interface.tg_if2.private_ip_address } route { name = "tg1" - address_prefix = "192.168.10.0/24" + address_prefix = var.vpc_cidr_b next_hop_type = "VirtualAppliance" - next_hop_in_ip_address = "192.168.20.11" + next_hop_in_ip_address = data.azurerm_network_interface.dut2_if2.private_ip_address } } diff --git a/resources/tools/terraform/azure/nic.tf b/resources/tools/terraform/azure/nic.tf index 8bacd4ad33..51692593c6 100644 --- a/resources/tools/terraform/azure/nic.tf +++ b/resources/tools/terraform/azure/nic.tf @@ -12,7 +12,7 @@ resource "azurerm_network_interface" "dut1_if2" { name = "dut1_if2" subnet_id = azurerm_subnet.c.id private_ip_address_allocation = "Static" - private_ip_address = "200.0.0.101" + private_ip_address = "172.16.200.101" } } @@ -34,7 +34,7 @@ resource "azurerm_network_interface" "dut2_if1" { name = "dut2_if1" subnet_id = azurerm_subnet.c.id private_ip_address_allocation = "Static" - private_ip_address = "200.0.0.102" + private_ip_address = "172.16.200.102" } } @@ -56,7 +56,7 @@ resource "azurerm_network_interface" "dut1_if1" { name = "dut1_if1" subnet_id = azurerm_subnet.b.id private_ip_address_allocation = "Static" - private_ip_address = "192.168.10.11" + private_ip_address = "172.16.10.11" } } @@ -78,7 +78,7 @@ resource "azurerm_network_interface" "dut2_if2" { name = "dut2_if2" subnet_id = azurerm_subnet.d.id private_ip_address_allocation = "Static" - private_ip_address = "192.168.20.11" + private_ip_address = "172.16.20.11" } } @@ -100,7 +100,7 @@ resource "azurerm_network_interface" "tg_if1" { name = "tg1" subnet_id = azurerm_subnet.b.id private_ip_address_allocation = "Static" - private_ip_address = "192.168.10.254" + private_ip_address = "172.16.10.250" } } @@ -122,7 +122,7 @@ resource "azurerm_network_interface" "tg_if2" { name = "tg2" subnet_id = azurerm_subnet.d.id private_ip_address_allocation = "Static" - private_ip_address = "192.168.20.254" + private_ip_address = "172.16.20.250" } } |