resource "google_filestore_instance" "filestore" {
provider = "google-beta"
name = "filestore"
tier = "STANDARD"
zone = "europe-north1-a"
file_shares {
name = "default"
capacity_gb = 1024
}
networks {
network = "default"
modes = ["MODE_IPV4"]
}
}
as only "networks" is exposed and it contains:
[
{
ip_addresses = [10.3.14.210]
modes = [MODE_IPV4]
network = default
reserved_ip_range = 10.3.14.208/29
}
]
this combination of lists and maps is famously impossible to deal with terraform because of lack of support for element: element() may only be used with flat lists, this list contains elements of type map in: and does not have homogenous types. found TypeString and then TypeList
currently I'm dumping this as json and picking the ip with jq with null_provider local-exec...
locals {
filestore_networks_as_json = "${
jsonencode(google_filestore_instance.filestore.networks[0])
}"
filestore_networks_json_split = "${
split(
"\"",
local.filestore_networks_as_json
)
}"
}
output "filestore_ip" {
value = "${
local.filestore_networks_json_split[3]
}"
}
^-- horrible workaround
okay so this works: google_filestore_instance.filestore.networks.0.ip_addresses.0
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!