On a multi-bucket configuration, adding a soft_delete_policy configuration block like so:
soft_delete_policy = {
"bucket1" = {
// Disable protection on this bucket
retention_duration_seconds = 0
}
"bucket2" = {
// Increase protection to the max value (90 days)
retention_duration_seconds = 7776000
}
}
; results in the following error:
│ Error: Invalid function argument
│
│ on .terraform/modules/gcs.cloud_storage/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.
Expected behavior
The module should allow to create a soft_delete block for a multibucket configuration without issues.
TL;DR
On a multi-bucket configuration, adding a soft_delete_policy configuration block like so:
soft_delete_policy = { "bucket1" = { // Disable protection on this bucket retention_duration_seconds = 0 } "bucket2" = { // Increase protection to the max value (90 days) retention_duration_seconds = 7776000 } } ; results in the following error:
│ Error: Invalid function argument │ │ on .terraform/modules/gcs.cloud_storage/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.
Expected behavior
The module should allow to create a soft_delete block for a multibucket configuration without issues.
There is a PR opened to solve this https://github.com/terraform-google-modules/terraform-google-cloud-storage/pull/318
Observed behavior
The buckets should have the correct soft_delete retention time when deployed
Terraform Configuration
Terraform Version
Additional information
No response