You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default value of soft_delete_policy should be a string instead of an empty object, since it should be the same type as keys of the map
Expected behavior
No error should be thrown
Observed behavior
│ Error: Invalid function argument
│
│ on .terraform/modules/gcs_buckets/main.tf line 160, in resource "google_storage_bucket" "buckets":
│ 160: for_each = [lookup(var.soft_delete_policy, each.value, {})]
│ ├────────────────
│ │ while calling lookup(inputMap, key, default...)
│
│ Invalid value for "default" parameter: the default value must have the same type as the map elements.
Terraform Configuration
Here is the tfvars value I am currently using
soft_delete_policy={
"development-terraform"= { retention_duration_seconds =604800 } # 7 days"production-terraform"= { retention_duration_seconds =604800 } # 7 days
}
TL;DR
for_each = [lookup(var.soft_delete_policy, each.value, {})]
The default value of soft_delete_policy should be a string instead of an empty object, since it should be the same type as keys of the map
Expected behavior
No error should be thrown
Observed behavior
│ Error: Invalid function argument
│
│ on .terraform/modules/gcs_buckets/main.tf line 160, in resource "google_storage_bucket" "buckets":
│ 160: for_each = [lookup(var.soft_delete_policy, each.value, {})]
│ ├────────────────
│ │ while calling lookup(inputMap, key, default...)
│
│ Invalid value for "default" parameter: the default value must have the same type as the map elements.
Terraform Configuration
Terraform Version
Additional information
Should be an easy fix, just replace empty object {} with empty string ""
https://developer.hashicorp.com/terraform/language/functions/lookup
The text was updated successfully, but these errors were encountered: