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, complementingtemplatefilefor 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 -jsonemits machine-readable UI output for automation.- Interactive
terraform consoleaccepts multi-line expressions when delimiters remain open. - Terraform tests can pass dynamically sensitive values to variables without requiring a static
sensitive = truedeclaration on the receiving variable. - A
movedblock can migratenull_resourceinstances to the built-interraform_dataresource type.