Browse Source

Remove deprecation Warning, but UUID of port needs to be assigned, throws an error in current state

master
Max Cherris 7 months ago
parent
commit
bf84c43c41
  1. 22
      terraform/lab1/lab1.tf

22
terraform/lab1/lab1.tf

@ -1,7 +1,7 @@
# Define CloudComp group number
variable "group_number" {
type = string
default = "<number of your group here, private-cloud is only reachable via vpn>"
default = "32"
}
## OpenStack credentials can be used in a more secure way by using
@ -13,8 +13,8 @@ variable "group_number" {
# Define OpenStack credentials, project config etc.
locals {
auth_url = "https://10.32.4.182:5000/v3"
user_name = "CloudComp${var.group_number}"
user_password = "<password of your group here, private-cloud is only reachable via vpn>"
user_name = "CloudComp32"
user_password = "demo"
tenant_name = "CloudComp${var.group_number}"
#network_name = "CloudComp${var.group_number}-net"
router_name = "CloudComp${var.group_number}-router"
@ -116,6 +116,16 @@ resource "openstack_networking_subnet_v2" "terraform-subnet-1" {
dns_nameservers = local.dns_nameservers
}
resource "openstack_networking_port_v2" "port_1" {
name = "port_1"
network_id = openstack_networking_network_v2.terraform-network-1.id
admin_state_up = "true"
fixed_ip {
subnet_id = openstack_networking_subnet_v2.terraform-subnet-1.id
}
}
data "openstack_networking_router_v2" "router-1" {
name = local.router_name
}
@ -176,12 +186,12 @@ resource "openstack_networking_floatingip_v2" "fip_1" {
pool = local.floating_net
}
resource "openstack_compute_floatingip_associate_v2" "terraform-instance-1-ip" {
resource "openstack_networking_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
port_id = "port_1"
}
# does not work, though openstack_compute_floatingip_associate_v2 is deprecated,
# does 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" {

Loading…
Cancel
Save