From be5dead8695535179af07e29f20166e86dea9094 Mon Sep 17 00:00:00 2001 From: "Falk B. Schimweg" Date: Wed, 6 Mar 2024 15:43:30 +0100 Subject: [PATCH 1/2] Do not use deprecated openstack_compute_floatingip_associate_v2 --- simple-instance/instances-blue.tf | 14 +++++++++++--- simple-instance/instances-red.tf | 15 +++++++++++---- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/simple-instance/instances-blue.tf b/simple-instance/instances-blue.tf index 2b6bef0..290bea6 100644 --- a/simple-instance/instances-blue.tf +++ b/simple-instance/instances-blue.tf @@ -6,7 +6,7 @@ resource "openstack_compute_instance_v2" "instance_blue" { security_groups = [openstack_networking_secgroup_v2.sg_ssh.name] network { - uuid = openstack_networking_network_v2.net_blue.id + port = openstack_networking_port_v2.port_blue.id } lifecycle { @@ -18,8 +18,16 @@ resource "openstack_networking_floatingip_v2" "fip_blue" { pool = var.external_network } -resource "openstack_compute_floatingip_associate_v2" "fipas_blue" { +resource "openstack_networking_port_v2" "port_blue" { + name = "BLUE Port" + network_id = openstack_networking_network_v2.net_blue.id + fixed_ip { + subnet_id = openstack_networking_subnet_v2.subnet_blue.id + } +} + +resource "openstack_networking_floatingip_associate_v2" "fipas_blue" { floating_ip = openstack_networking_floatingip_v2.fip_blue.address - instance_id = openstack_compute_instance_v2.instance_blue.id + port_id = openstack_networking_port_v2.port_blue.id } diff --git a/simple-instance/instances-red.tf b/simple-instance/instances-red.tf index a1ebedc..00a15bf 100644 --- a/simple-instance/instances-red.tf +++ b/simple-instance/instances-red.tf @@ -6,7 +6,7 @@ resource "openstack_compute_instance_v2" "instance_red" { security_groups = [openstack_networking_secgroup_v2.sg_ssh.name] network { - uuid = openstack_networking_network_v2.net_red.id + port = openstack_networking_port_v2.port_red.id } lifecycle { @@ -18,8 +18,15 @@ resource "openstack_networking_floatingip_v2" "fip_red" { pool = var.external_network } -resource "openstack_compute_floatingip_associate_v2" "fipas_red" { - floating_ip = openstack_networking_floatingip_v2.fip_red.address - instance_id = openstack_compute_instance_v2.instance_red.id +resource "openstack_networking_port_v2" "port_red" { + name = "RED Port" + network_id = openstack_networking_network_v2.net_red.id + fixed_ip { + subnet_id = openstack_networking_subnet_v2.subnet_red.id + } } +resource "openstack_networking_floatingip_associate_v2" "fipas_red" { + floating_ip = openstack_networking_floatingip_v2.fip_red.address + port_id = openstack_networking_port_v2.port_red.id +} From a4568db8948f828e46aa3e7fc7485be248a6ba43 Mon Sep 17 00:00:00 2001 From: "Falk B. Schimweg" Date: Wed, 6 Mar 2024 15:55:26 +0100 Subject: [PATCH 2/2] Do not use deprecated openstack_compute_floatingip_associate_v2 --- simple-instance-v6/instances-blue.tf | 14 +++++++++++--- simple-instance-v6/instances-red.tf | 14 +++++++++++--- simple-instance/instances-red.tf | 1 + 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/simple-instance-v6/instances-blue.tf b/simple-instance-v6/instances-blue.tf index 2b6bef0..290bea6 100644 --- a/simple-instance-v6/instances-blue.tf +++ b/simple-instance-v6/instances-blue.tf @@ -6,7 +6,7 @@ resource "openstack_compute_instance_v2" "instance_blue" { security_groups = [openstack_networking_secgroup_v2.sg_ssh.name] network { - uuid = openstack_networking_network_v2.net_blue.id + port = openstack_networking_port_v2.port_blue.id } lifecycle { @@ -18,8 +18,16 @@ resource "openstack_networking_floatingip_v2" "fip_blue" { pool = var.external_network } -resource "openstack_compute_floatingip_associate_v2" "fipas_blue" { +resource "openstack_networking_port_v2" "port_blue" { + name = "BLUE Port" + network_id = openstack_networking_network_v2.net_blue.id + fixed_ip { + subnet_id = openstack_networking_subnet_v2.subnet_blue.id + } +} + +resource "openstack_networking_floatingip_associate_v2" "fipas_blue" { floating_ip = openstack_networking_floatingip_v2.fip_blue.address - instance_id = openstack_compute_instance_v2.instance_blue.id + port_id = openstack_networking_port_v2.port_blue.id } diff --git a/simple-instance-v6/instances-red.tf b/simple-instance-v6/instances-red.tf index a1ebedc..9199577 100644 --- a/simple-instance-v6/instances-red.tf +++ b/simple-instance-v6/instances-red.tf @@ -6,7 +6,7 @@ resource "openstack_compute_instance_v2" "instance_red" { security_groups = [openstack_networking_secgroup_v2.sg_ssh.name] network { - uuid = openstack_networking_network_v2.net_red.id + port = openstack_networking_port_v2.port_red.id } lifecycle { @@ -18,8 +18,16 @@ resource "openstack_networking_floatingip_v2" "fip_red" { pool = var.external_network } -resource "openstack_compute_floatingip_associate_v2" "fipas_red" { +resource "openstack_networking_port_v2" "port_red" { + name = "RED Port" + network_id = openstack_networking_network_v2.net_red.id + fixed_ip { + subnet_id = openstack_networking_subnet_v2.subnet_red.id + } +} + +resource "openstack_networking_floatingip_associate_v2" "fipas_red" { floating_ip = openstack_networking_floatingip_v2.fip_red.address - instance_id = openstack_compute_instance_v2.instance_red.id + port_id = openstack_networking_port_v2.port_red.id } diff --git a/simple-instance/instances-red.tf b/simple-instance/instances-red.tf index 00a15bf..9199577 100644 --- a/simple-instance/instances-red.tf +++ b/simple-instance/instances-red.tf @@ -30,3 +30,4 @@ resource "openstack_networking_floatingip_associate_v2" "fipas_red" { floating_ip = openstack_networking_floatingip_v2.fip_red.address port_id = openstack_networking_port_v2.port_red.id } +