The thing is I know Terraform ignore_changes block only supports static lists or in another words, static indices mapping to items. Secondly, I need to be able to ignore specific metadata based on a regex.
I tried to use a local value and then use it in a list but it returned with the same error.
locals {
ignore_gke_metadata_changes = [
for x in google_compute_project_metadata.metadata.metadata : x.key if regex("^gke-dku[0-9]+$", x.key)
]
}
lifecycle {
ignore_changes = local.ignore_gke_metadata_changes
}
Edit:
Here's a sample of the error returned when I try to run a plan:
16: ignore_changes = local.ignore_gke_metadata_changes
A static list expression is required.