moved terraform lab1 example back to deprecated floating ip assignment as new implementation does not set port id
This commit is contained in:
parent
7a4bfc90b2
commit
c0904de73e
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ venv
|
||||
**/terraform.tfstate.backup
|
||||
**/.terraform.lock.hcl
|
||||
**/.terraform
|
||||
**/.terraform.tfstate.lock.info
|
||||
|
@ -165,6 +165,8 @@ resource "openstack_compute_instance_v2" "terraform-instance-1" {
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# assign floating ip to instance
|
||||
@ -172,9 +174,27 @@ resource "openstack_compute_instance_v2" "terraform-instance-1" {
|
||||
###########################################################################
|
||||
resource "openstack_networking_floatingip_v2" "fip_1" {
|
||||
pool = local.floating_net
|
||||
port_id = openstack_compute_instance_v2.terraform-instance-1.network[0].port
|
||||
}
|
||||
|
||||
resource "openstack_compute_floatingip_associate_v2" "terraform-instance-1-ip" {
|
||||
floating_ip = openstack_networking_floatingip_v2.fip_1.address
|
||||
instance_id = openstack_compute_instance_v2.terraform-instance-1.id
|
||||
}
|
||||
|
||||
# does not work, though openstack_compute_floatingip_associate_v2 is deprecated,
|
||||
# openstack_compute_instance_v2.terraform-instance-1.network[0].port is empty after instance creation: ""
|
||||
#
|
||||
#resource "openstack_networking_floatingip_associate_v2" "terraform-instance-1-ip" {
|
||||
# floating_ip = openstack_networking_floatingip_v2.fip_1.address
|
||||
# port_id = openstack_compute_instance_v2.terraform-instance-1.network[0].port
|
||||
#}
|
||||
#
|
||||
# even better, as soon as openstack_compute_instance_v2.terraform-instance-1.network[0].port is not "":
|
||||
#resource "openstack_networking_floatingip_v2" "fip_1" {
|
||||
# pool = local.floating_net
|
||||
# port_id = openstack_compute_instance_v2.terraform-instance-1.network[0].port
|
||||
#}
|
||||
|
||||
output "vip_addr" {
|
||||
value = openstack_networking_floatingip_v2.fip_1
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user