concept

Check blocks and failure behavior

A check contains assertions and optionally scoped data. False assertions warn during ordinary CLI operations; pending values can defer evaluation.

Formal Syntax & Structure

terraform syntaxterraform
Check blocks and failure behavior

Working Example

Example Snippetterraform
variable "ready_replicas" {  type    = number  default = 1}
resource "terraform_data" "report" {  input = var.ready_replicas}
check "capacity_report" {  assert {    condition     = terraform_data.report.output >= 2    error_message = "The synthetic report shows fewer than two ready replicas."  }}
Terraform Reference