I’m sure this has been answered somewhere, but I’m having trouble understanding/finding a solution.
I am iterating through a map that has hostname, ip_address and availability_set.
I want to use availability_set (which does not exist for all entries) to map to the availability set created. I am trying:
availability_set_id = each.value.availability_set != “” ? azurerm_availability_set.${each.value.availability_set}.id : null
But that is not good because of the $ after the dot. (Error: Invalid attribute name)
It tries if I quote things out, but then it doesn’t like the URI. (Error: parsing Azure ID: parse “azurerm_availability_set.test-as.id”: invalid URI for request)
If I put in azurerm_availability_set.test-as.id as the value without quoting, it can work, but then I am hard-coding a single availability set rather than mapping appropriately.
Is it possible to do such a mapping?
Thanks in advance for any insight,
Brian