Last active
December 19, 2022 16:43
-
-
Save calexandre/61607a50411385321a55268ded902bb4 to your computer and use it in GitHub Desktop.
azurerm-find-private-endpoint-zones.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
locals { | |
azurerm_private_endpoint = { | |
custom_dns_configs = [ | |
{ | |
"fqdn" = "something.westeurope.data.azurecr.io" | |
"ip_addresses" = [ | |
"10.10.10.202" | |
] | |
}, | |
{ | |
"fqdn" = "something.azurecr.io" | |
"ip_addresses" = [ | |
"10.10.10.204" | |
] | |
}, | |
] | |
} | |
fqdn_ips = {for k,v in local.azurerm_private_endpoint.custom_dns_configs : v.fqdn => v.ip_addresses } | |
records_to_create = local.fqdn_ips["something.azurecr.io"] | |
} | |
output "fqdn_ips" { | |
value = local.fqdn_ips | |
} | |
output "records_to_create" { | |
value = local.records_to_create | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @calexandre
I was trying this out but with no success still...
Running your sample (adapted to my scenario) I got the following result
> {for k,v in azurerm_private_endpoint.acr_private_endpoint_ne.custom_dns_configs : v.fqdn => v.ip_addresses }
the
tolist()
function appears here like a string... this makes the value a string and not a list...> ({for k,v in azurerm_private_endpoint.acr_private_endpoint_ne.custom_dns_configs : v.fqdn => v.ip_addresses })["acrmydevne.azurecr.io"]