From 0124413fc1160fb7327432a23c0bc8bb9a4e3750 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 6 Nov 2023 16:35:41 +0100 Subject: [PATCH] Use the subnet_id to place the octavia interfaces. --- openstack-tf/common_setups/10-main-network.tf | 5 +++++ openstack-tf/common_setups/20-octavia.tf | 2 +- .../production-basic-infrastructure.auto.tfvars | 15 +++++++++++++++ .../d4s-production/variables/00-variables.tf | 12 ++++++------ 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/openstack-tf/common_setups/10-main-network.tf b/openstack-tf/common_setups/10-main-network.tf index cca5cf2..4ee4780 100644 --- a/openstack-tf/common_setups/10-main-network.tf +++ b/openstack-tf/common_setups/10-main-network.tf @@ -59,6 +59,11 @@ output "main_private_network_id" { value = openstack_networking_network_v2.main-private-network.id } +output "main_subnet_network_id" { + description = "Main subnet network id" + value = openstack_networking_subnet_v2.main-private-subnet.id +} + output "dns_zone_id" { description = "Id of the new DNS zone" value = openstack_dns_zone_v2.primary_project_dns_zone.id diff --git a/openstack-tf/common_setups/20-octavia.tf b/openstack-tf/common_setups/20-octavia.tf index 2d43eb2..4a8cbd5 100644 --- a/openstack-tf/common_setups/20-octavia.tf +++ b/openstack-tf/common_setups/20-octavia.tf @@ -1,6 +1,6 @@ # Main load balancer. L4, backed by Octavia resource "openstack_lb_loadbalancer_v2" "main_lb" { - vip_network_id = var.main_private_network_id + vip_subnet_id = var.main_private_subnet_id name = var.octavia_information.main_lb_name description = var.octavia_information.main_lb_description flavor_id = var.octavia_information.octavia_flavor_id diff --git a/openstack-tf/d4s-production/basic-infrastructure/production-basic-infrastructure.auto.tfvars b/openstack-tf/d4s-production/basic-infrastructure/production-basic-infrastructure.auto.tfvars index 871ec85..ccb98ee 100644 --- a/openstack-tf/d4s-production/basic-infrastructure/production-basic-infrastructure.auto.tfvars +++ b/openstack-tf/d4s-production/basic-infrastructure/production-basic-infrastructure.auto.tfvars @@ -18,4 +18,19 @@ shared_postgresql_server_data = { # Provided in the output of the project setup main_private_network_id = "020df98d-ae72-452a-b376-3b6dc289acac" +main_private_subnet_id = "5d7b83ad-e058-4a3a-bfd8-d20ba6d42e1a" dns_zone_id = "74135b34-1a9c-4c01-8cf0-22450a5660c4" + +octavia_information = { + main_lb_name = "d4s-production-cloud-l4-load-balancer" + main_lb_description = "Main L4 load balancer for the D4Science production" + swarm_lb_name = "d4s-production-cloud-l4-swarm-load-balancer" + octavia_flavor = "octavia_amphora-mvcpu-ha" + octavia_flavor_id = "394988b5-6603-4a1e-a939-8e177c6681c7" + main_lb_hostname = "main-lb" + # The following aren't available when the module runs so we have to get them with the command + # openstack --os-cloud d4s-pre port list -f value | grep octavia-lb-vrrp + # This means that the execution will fail + octavia_vrrp_ip_1 = "10.1.42.119/32" + octavia_vrrp_ip_2 = "10.1.42.188/32" +} diff --git a/openstack-tf/d4s-production/variables/00-variables.tf b/openstack-tf/d4s-production/variables/00-variables.tf index 1179db9..47cf1f9 100644 --- a/openstack-tf/d4s-production/variables/00-variables.tf +++ b/openstack-tf/d4s-production/variables/00-variables.tf @@ -46,6 +46,11 @@ variable "main_private_subnet" { } } +variable "main_private_subnet_id" { + # Set with the correct value after the setup is complete + default = "" +} + variable "external_router" { type = map(string) default = { @@ -88,10 +93,5 @@ variable "octavia_information" { octavia_flavor = "octavia_amphora-mvcpu-ha" octavia_flavor_id = "394988b5-6603-4a1e-a939-8e177c6681c7" main_lb_hostname = "main-lb" - # The following aren't available when the module runs so we have to get them with the command - # openstack --os-cloud d4s-pre port list -f value | grep octavia-lb-vrrp - # This means that the execution will fail - octavia_vrrp_ip_1 = "10.1.42.83/32" - octavia_vrrp_ip_2 = "10.1.44.249/32" - } + } }