{
  "schemaVersion": "ebb.rule.v1",
  "id": "terraform.syntax.interpolation-only",
  "ecosystem": "terraform",
  "purl": "pkg:generic/terraform",
  "affectedVersions": "vers:semver/>=0.12.14",
  "event": "deprecated",
  "severity": "low",
  "title": "Interpolation-only strings are deprecated",
  "summary": "Terraform v0.12.14 deprecated a string whose whole value is one interpolation, such as \"${var.name}\": the same value is written as the bare expression var.name. Terraform still accepts the quoted form but recommends the bare expression for readability, and terraform fmt repairs simple examples. A string that mixes text with an interpolation, such as \"prefix-${var.name}\", is not the deprecated form and still needs its quotes.",
  "replacement": "The same expression without the surrounding quotes, such as var.name",
  "sources": [
    {
      "title": "hashicorp/terraform release v0.12.14",
      "url": "https://github.com/hashicorp/terraform/releases/tag/v0.12.14",
      "accessedAt": "2026-10-31"
    },
    {
      "title": "Terraform 0.15 upgrade guide: legacy configuration language features",
      "url": "https://developer.hashicorp.com/terraform/language/v1.1.x/upgrade-guides/0-15",
      "accessedAt": "2026-10-31"
    },
    {
      "title": "Terraform 0.12 upgrade guide: first-class expressions",
      "url": "https://developer.hashicorp.com/terraform/language/v1.1.x/upgrade-guides/0-12",
      "accessedAt": "2026-10-31"
    }
  ],
  "provenance": {
    "observedAt": "2026-10-31",
    "reviewedAt": "2026-10-31",
    "reviewer": "arminazimi"
  },
  "migration": {
    "constraints": [
      "Rewrite only a string whose entire value is one ${ ... } interpolation. A string with any literal text, a %{ ... } directive, or an escape sequence must keep its quotes.",
      "Do not remove the quotes from an object key or a block label: those strings are not expressions, and the bare form would not be valid HCL.",
      "Each rewrite is a syntactic one-to-one change with the same expression inside the interpolation, so plan output should not change."
    ],
    "steps": [
      {
        "id": "drop-interpolation-quotes",
        "title": "Replace the quoted interpolation with its expression",
        "instructions": "Change `value = \"${var.name}\"` to `value = var.name`, keeping the expression exactly as written inside the interpolation.",
        "targets": "declaration"
      },
      {
        "id": "align-other-interpolations",
        "title": "Repair the other interpolation-only strings",
        "instructions": "Repeat for every string in *.tf that contains exactly one interpolation and no other text. Run terraform fmt to catch simple examples the codemod did not rewrite.",
        "targets": "all"
      }
    ],
    "verification": [
      {
        "command": "terraform init -backend=false && terraform validate",
        "purpose": "Initialize without touching remote state and check that the rewritten expressions are valid HCL."
      },
      {
        "command": "terraform plan",
        "purpose": "Confirm the rewrite evaluates to the same values and the plan is unchanged."
      }
    ]
  }
}
