Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lookup default value for soft delete policy results in Error #324

Closed
vdcadena553 opened this issue Jun 26, 2024 · 1 comment
Closed

lookup default value for soft delete policy results in Error #324

vdcadena553 opened this issue Jun 26, 2024 · 1 comment
Labels
bug Something isn't working Stale

Comments

@vdcadena553
Copy link

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 #318

Observed behavior

The buckets should have the correct soft_delete retention time when deployed

Terraform Configuration

module "db_storage_buckets" {
  source     = "terraform-google-modules/cloud-storage/google"
  project_id =  "projectid"
  version    = "~>6.0"
  prefix     = "es-leg-uat"
  names      = ["backups", "tranlogs", "worm-backups", "worm-tranlogs"]
  location   = "US"

  soft_delete_policy = {
    "backups" = {
      retention_time_in_seconds = 0
    },
    "worm-tranlogs" = {
      retention_time_in_seconds = 0
    },
    "worm-backups" = {
      retention_time_in_seconds = 0
    },
    "tranlogs" ={
      retention_time_in_seconds = 0
    }
  }
}

Terraform Version

1.8.5

Additional information

No response

@vdcadena553 vdcadena553 added the bug Something isn't working label Jun 26, 2024
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Aug 25, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

1 participant