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.tfstate.backup
|
||||||
**/.terraform.lock.hcl
|
**/.terraform.lock.hcl
|
||||||
**/.terraform
|
**/.terraform
|
||||||
|
**/.terraform.tfstate.lock.info
|
||||||
|
@ -14,7 +14,7 @@ variable "group_number" {
|
|||||||
locals {
|
locals {
|
||||||
auth_url = "https://10.32.4.182:5000/v3"
|
auth_url = "https://10.32.4.182:5000/v3"
|
||||||
user_name = "CloudComp${var.group_number}"
|
user_name = "CloudComp${var.group_number}"
|
||||||
user_password = "<password of your group here, private-cloud is only reachable via vpn>"
|
user_password = "<password of your group here, private-cloud is only reachable via vpn>"
|
||||||
tenant_name = "CloudComp${var.group_number}"
|
tenant_name = "CloudComp${var.group_number}"
|
||||||
#network_name = "CloudComp${var.group_number}-net"
|
#network_name = "CloudComp${var.group_number}-net"
|
||||||
router_name = "CloudComp${var.group_number}-router"
|
router_name = "CloudComp${var.group_number}-router"
|
||||||
@ -165,6 +165,8 @@ resource "openstack_compute_instance_v2" "terraform-instance-1" {
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
#
|
#
|
||||||
# assign floating ip to instance
|
# assign floating ip to instance
|
||||||
@ -172,9 +174,27 @@ resource "openstack_compute_instance_v2" "terraform-instance-1" {
|
|||||||
###########################################################################
|
###########################################################################
|
||||||
resource "openstack_networking_floatingip_v2" "fip_1" {
|
resource "openstack_networking_floatingip_v2" "fip_1" {
|
||||||
pool = local.floating_net
|
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" {
|
output "vip_addr" {
|
||||||
value = openstack_networking_floatingip_v2.fip_1
|
value = openstack_networking_floatingip_v2.fip_1
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user