7

I want simplify such construction

variable "google" {
  type = object({
    project      = string
    region       = string
    zone         = string
  })
}

provider "google" {
  project = var.google.project
  region  = var.google.region
  zone    = var.google.zone
}

Does HCL have something similar to spread operator?

galkin
  • 5,264
  • 3
  • 34
  • 51

1 Answers1

4

What you've written here is the shortest possible way to write what you've shown in the Terraform language. There is no mechanism to populate the arguments of a block dynamically from the attributes of an object.

Martin Atkins
  • 62,420
  • 8
  • 120
  • 138