Terraform 1 9

Apply Terraform 1.9 language, CLI, state, testing, migration, and behaviour changes. Load for Terraform work targeting 1.9 or later when the model's knowledge may predate the 2024-06-26 release.

cedws a4e8215 2 files · 1.6 KB Updated

File contents

Terraform 1.9

This overview applies when the project's target Terraform version is at least 1.9.

Expressions and validation

  • Input-variable validation conditions can refer to other input variables, data resources, and other objects in the same module. This permits cross-field and environment-aware validation.
  • templatestring(template, vars) renders template text obtained dynamically, complementing templatefile for templates loaded from a data source or other expression.
variable "min_size" {
  type = number
}

variable "max_size" {
  type = number

  validation {
    condition     = var.max_size >= var.min_size
    error_message = "max_size must not be smaller than min_size."
  }
}

CLI and testing

  • terraform init -json emits machine-readable UI output for automation.
  • Interactive terraform console accepts multi-line expressions when delimiters remain open.
  • Terraform tests can pass dynamically sensitive values to variables without requiring a static sensitive = true declaration on the receiving variable.
  • A moved block can migrate null_resource instances to the built-in terraform_data resource type.

cedws/skills/tree/main/terraform/skills/terraform-1-9 commit a4e8215913

Frequently asked questions

npx skillmds@latest add cedws/terraform-1-9