Hi there,
I have a variable as below, setting a list with security groups from a remote_state:
variable "instances" {
description = "instances to be deployed"
type = map(object({
ufqdn = string
...
secgroups = list(string)
}))
default = {
"instance-1" = {
ufqdn = "instance-1.domain.com"
...
secgroups = [ "data.terraform_remote_state.network.outputs.secgroup1",
"data.terraform_remote_state.network.outputs.secgroup2", **
"data.terraform_remote_state.network.outputs.secgroup3"**
]
},
"instance-2" = {
ufqdn = "instance-2.domain.com"
...
secgroups = [ "data.terraform_remote_state.network.outputs.secgroup4",
"data.terraform_remote_state.network.outputs.secgroup5",
"data.terraform_remote_state.network.outputs.secgroup6"
]
}
}
And the .tf consuming the variable is below:
resource "openstack_networking_port_v2" "port_instance" {
for_each = var.instances
name = "port-${each.value.ufqdn}"
network_id = data.terraform_remote_state.network.outputs.network_id
security_group_ids = each.value.secgroups
Whenever I try to apply this definition, I got an error saying that the IDs weren’t found.
The problem seems that I cannot use variables as inputs.
Any clue on how to use variables as inputs for other variables?
Thanks in advance,