Spread operator at terraform files

Viewed 671

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?

1 Answers

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.

Related