{
  "slug": "terraform-stacks-input-variable-validation-454de880e074",
  "title": "Terraform Stacks input variable validation",
  "tools": [
    "terraform"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-04-29T14:05:34.000Z",
  "announced_at": "2026-04-29T14:05:34.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When a Terraform Stack input variable needs a rule before planning proceeds, add a `validation` block to that variable; its `condition` must reference that variable as `var.<NAME>` and resolve to a boolean.",
    "examples": [
      "variable \"prefix\" {\n  type = string\n\n  validation {\n    condition     = length(var.prefix) > 5\n    error_message = \"prefix must be longer than 5 characters.\"\n  }\n}"
    ],
    "gotchas": [
      "Version: 1.15.0",
      "validation.condition (required): Expression that must evaluate to true for Terraform to proceed. For this Stack feature, it references the containing variable as `var.<NAME>` and resolves to a boolean.",
      "validation.error_message (required): String displayed if the condition evaluates to false.",
      "Terraform version (required): Use Terraform v1.15.0 or later for Stack input variable validation.",
      "Prerequisite: Terraform v1.15.0 introduced input variable validation for Stacks.",
      "The condition expression can reference the `var.<NAME>` value for the variable that contains it and resolves to a boolean."
    ]
  },
  "why_it_matters": "Validate an input variable in a Terraform Stack before its value reaches a provider.",
  "sources": [
    "https://github.com/hashicorp/terraform/releases/tag/v1.15.0",
    "https://github.com/hashicorp/terraform/pull/38240",
    "https://developer.hashicorp.com/terraform/language/block/variable"
  ],
  "rank": 0.95039,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave1b-20261016",
    "verdict_id": "wave1b-20261016:wave1b-20261016-d17819c10e9fea85-14:gate",
    "evidence_hash": "16bec6ef2c7e0d436c7f5efd8b0757c97f98898e49a1f97c8a61276d3aa64597"
  },
  "review": {
    "draft_hash": "4e05d75f459a0eee42078a96eab7ab1a19bc7b499b5b0179d88ad20093b2a7e8",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave1b-20261016:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.95 >= 0.9; 2 needed) and Jev gave 0.74 (>= 0.6 needed)."
  }
}
