Hello, any idea how to extract from the code below fixed_ip_v4
for network named test
? I’d like to extract that value for ansible inventory.
resource "openstack_compute_instance_v2" "test_terraform_instance" {
name = "tmpnode${count.index}"
count = var.node_count
provider = openstack.ovh
image_name = "Debian 10"
flavor_name = var.flavor_name #"s1-2"
key_pair = openstack_compute_keypair_v2.test_keypair.name
network {
name = "Ext-Net"
}
network {
name = "test"
fixed_ip_v4 = element(var.front_private_ip, count.index)
}
}
What I already tried and the errors:
-
openstack_compute_instance_v2.test_terraform_instance[*].network.name[test].fixed_ip_v4
?Can’t access attributes on a list of objects. Did you mean to access attribute “name” for a specific element of the list, or across all elements of the list?
-
openstack_compute_instance_v2.test_terraform_instance[*].network[*].fixed_ip_v4.network[“test”].fixed_ip_v4
Doesn’t work without double and with single quotes in network[“test”] neither.