osinfra-io/google-cloud-hierarchy

Improve resource name for `resource "google_folder" "environment"`

brettcurtis opened this issue · 0 comments

Description

The resource:

resource "google_folder" "environment" {
  for_each = { for folder in local.environments : "${folder.system}.${folder.environment}" => folder }

  display_name = each.value.environment
  parent       = google_folder.folder_system[each.value.system].name
}

Generates some funky resource names using `"${folder.system}.${folder.environment}" what can we do to improve on this?

Acceptance

  • Ideally, we can do something without adding a new value
  • Resource names normalized

Implementation Notes

Example:

  # google_folder.environment["system_2.Non-Production"] will be created
  + resource "google_folder" "environment" {
      + create_time     = (known after apply)
      + display_name    = "Non-Production"
      + folder_id       = (known after apply)
      + id              = (known after apply)
      + lifecycle_state = (known after apply)
      + name            = (known after apply)
      + parent          = (known after apply)
    }

Additional Context

#21 #22