Terraform variable validation
Jump to navigation
Jump to search
validation
variable validation [1]
variable "aws_region" { type = string description = "region used to deploy workloads" default = "us-east-1" validation { condition = can(regex("^us-", var.aws_region)) error_message = "The aws_region value must be a valid region in the USA, starting with \"us-\"." } }
- Since Terraform 1.2 (2022):
precondition
andpostcondition
added for improving code and input validation
See also
Advertising: