---
schema_version: 1
route: /t/terraform.md
tool: "terraform"
---

# sincecutoff.com /t/terraform — Terraform

- name: Terraform
- kind: cli
- children: none
- homepage: <https://github.com/hashicorp/terraform>

Changes to the tools coding agents drive, since a model's training cutoff, each linked to its first-party source. Check installed versions and limitations before acting; a cutoff date does not establish what a model knows.
Original editorial content: [Apache 2.0](https://sincecutoff.com/v1/data-license.txt), by [0xPatrick](https://0xpatrick.dev). Preserve applicable license and [NOTICE](https://sincecutoff.com/notice.txt) attribution when redistributing. Third-party source text and examples retain their own rights. [License scope and attribution](https://sincecutoff.com/v1/license.json).
To stay current, read the changes feed: [`/v1/changes.md?tool=terraform`](https://sincecutoff.com/v1/changes.md?tool=terraform) (or `.json`), adding `since=YYYY-MM-DD` for your training cutoff. Entries for registered children are included; the registry itself is `/v1/tools.json`. How to page and save your place: [llms.txt](https://sincecutoff.com/llms.txt).

### terraform console accepts a module scope (2026-08-26)
- slug: terraform-console-accepts-a-module-scope-4f6d5af24b07
- score: 0.95

How to use it:

When you need to evaluate an expression in a child module, run `terraform console` with `-scope` set to that module’s address. Add an index or key for a specific `count` or `for_each` instance.

Examples:

```
printf '%s\n' '<expression>' | terraform console -scope='module.<name>'
```

```
printf '%s\n' '<expression>' | terraform console -scope='module.<name>[0]'
```

```
printf '%s\n' '<expression>' | terraform console -scope='module.<name>["<key>"]'
```

- why_it_matters: Evaluate a Terraform expression in the context of a module or module instance.
- before: The console evaluated expressions in the root module by default.
- sources: <https://github.com/hashicorp/terraform/releases/tag/v1.16.0>, <https://developer.hashicorp.com/terraform/cli/commands/console>
- gotchas: "Version: 1.16.0"; "-scope=<module address>: Selects the module scope for expression evaluation; omit to use the root module. Use a module address, with an index for `count` instances or a key for `for_each` instances."; "Prerequisite: Terraform v1.16.0 or later for this flag, introduced in v1.16.0."; "Prerequisite: The selected child module must be present in the configuration; instance addresses use an index for `count` or a key for `for_each`."; "The module scope is specified as a module address; the flag is optional."

### terraform graph can output Mermaid format (2026-08-26)
- slug: terraform-graph-can-output-mermaid-format-75986e4d2221
- score: 0.97

How to use it:

For a dependency graph in Mermaid format, run `terraform graph -format=mermaid` from the Terraform working directory. Terraform 1.16.0 release notes document the new flag; current v1.16.x command docs do not list its syntax or parameter details.

- why_it_matters: Render a Terraform dependency graph in Mermaid for repository review or documentation.
- sources: <https://github.com/hashicorp/terraform/releases/tag/v1.16.0>
- gotchas: "Version: 1.16.0"

### terraform state show supports JSON output (2026-08-26)
- slug: terraform-state-show-supports-json-output-51299e9c49b1
- score: 0.98

How to use it:

When a script needs machine-readable data for one resource in state, run `terraform state show -json <ADDRESS>`.

Examples:

```
terraform state show -json 'packet_device.worker'
```

- why_it_matters: Read resource state in a script that needs machine-readable output.
- sources: <https://github.com/hashicorp/terraform/releases/tag/v1.16.0>, <https://developer.hashicorp.com/terraform/cli/commands/state/show>
- gotchas: "Version: 1.16.0"; "ADDRESS (required): Address in resource addressing format that points to a single resource."; "-json: Displays the resource in machine-readable JSON output."; "-state=path: Path to the state file; defaults to `terraform.tfstate`. Legacy option for the local backend only."; "Prerequisite: Terraform v1.16 or later is required for `-json`."; "Prerequisite: If provider schemas have changed since the state was written, upgrade the state first. For a state file, run `terraform refresh` first."

### terraform workspace list supports JSON output (2026-08-26)
- slug: terraform-workspace-list-supports-json-output-9e400be00337
- score: 0.98

How to use it:

When a script needs machine-readable workspace enumeration, run `terraform workspace list -json` to emit JSON output.

Examples:

```
terraform workspace list -json
```

- why_it_matters: Enumerate workspaces in a script that needs machine-readable output.
- sources: <https://github.com/hashicorp/terraform/releases/tag/v1.16.0>, <https://developer.hashicorp.com/terraform/cli/commands/workspace/list>
- gotchas: "Version: 1.16.0"; "-json: Produce machine-readable JSON output; always disables color."

### Terraform module sources and versions support variables and locals (2026-04-29)
- slug: terraform-module-sources-and-versions-support-variables-and-locals-89758da570a3
- score: 0.96

How to use it:

When selecting a module source or registry version from configuration values, use input variables marked `const = true`; you can reference them directly or through locals. Provide their values with a supported variable mechanism, then run `terraform init` after changing the module source or version.

Examples:

```
variable "module_source" {
  type  = string
  const = true
}

module "example" {
  source = var.module_source
}

terraform plan -var='module_source=./<module-directory>'
```

```
variable "module_repo" {
  type  = string
  const = true
}

variable "module_ref" {
  type  = string
  const = true
}

locals {
  module_source = "git::https://example.com/${var.module_repo}.git?ref=${var.module_ref}"
}

module "example" {
  source = local.module_source
}

terraform plan -var='module_repo=<repository>' -var='module_ref=<branch-or-tag>'
```

```
variable "module_version" {
  type  = string
  const = true
}

module "example" {
  source  = "<registry-namespace>/<module>/<provider>"
  version = var.module_version
}

terraform plan -var='module_version=<version-constraint>'
```

- why_it_matters: Select a module source or version using a configuration value.
- sources: <https://github.com/hashicorp/terraform/releases/tag/v1.15.0>, <https://github.com/hashicorp/terraform/pull/38217>, <https://developer.hashicorp.com/terraform/language/modules/configuration>, <https://developer.hashicorp.com/terraform/cli/commands/plan>, <https://developer.hashicorp.com/terraform/cli/config/environment-variables>, <https://developer.hashicorp.com/terraform/language/block/module?product_intent=terraform>
- gotchas: "Version: 1.15.0"; "const: Set to `true` for any input variable referenced by a module `source` or `version`; its value must be known during configuration loading."; "source (required): Module source expression; it can reference constant input variables and local values."; "version: Registry module version constraint; it can reference constant input variables and local values. Use only with a registry source."; "-var 'NAME=VALUE': Set one root input variable value; the option can be repeated."; "-var-file=FILENAME: Set root input variable values from a `.tfvars` file; the option can be repeated."; "TF_VAR_name: Environment variable form for setting an input variable; replace `name` with the variable name."; "Prerequisite: Terraform v1.15.0 introduced `const` variables for module source/version expressions."; "Prerequisite: Run `terraform init` after modifying a module `source` or `version`."; "Nested modules can use variables in module sources only when their input variables are declared `const = true`."; "The release text states that variables and locals are supported in module source and version attributes, but the linked description examples only show `source`."

### Terraform Stacks input variable validation (2026-04-29)
- slug: terraform-stacks-input-variable-validation-454de880e074
- score: 0.95

How to use it:

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" {
  type = string

  validation {
    condition     = length(var.prefix) > 5
    error_message = "prefix must be longer than 5 characters."
  }
}
```

- 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>
- 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."

### Terraform variable and output deprecation warnings (2026-04-29)
- slug: terraform-variable-and-output-deprecation-warnings-a2482b76ad24
- score: 0.96

How to use it:

When a variable or child-module output is deprecated, add a `deprecated` string explaining why; Terraform displays the reason when a value is passed to the variable or a consumer uses the output. [Variable reference](https://developer.hashicorp.com/terraform/language/block/variable) [Output reference](https://developer.hashicorp.com/terraform/language/block/output)

Examples:

```
variable "<name>" {
  type       = <type>
  deprecated = "<reason>"
}
```

```
output "<name>" {
  value      = <expression>
  deprecated = "<reason>"
}
```

- why_it_matters: Mark a variable or output as deprecated in a Terraform configuration.
- sources: <https://github.com/hashicorp/terraform/releases/tag/v1.15.0>, <https://developer.hashicorp.com/terraform/language/block/variable>, <https://developer.hashicorp.com/terraform/language/block/output>
- gotchas: "Version: 1.15.0"; "variable.deprecated: String explaining why the variable is deprecated; Terraform displays the reason when it is set in a root module or a child-module caller passes it a value."; "output.deprecated: String explaining why the output is deprecated. Valid only in child modules; consumers see the reason when they use the output."; "output.value (required): Expression whose result Terraform returns for the output."; "variable.type: Type constraint for the variable value."; "Prerequisite: Deprecated variables and outputs require Terraform v1.15 or later."; "Prerequisite: The output `deprecated` argument is valid only on outputs in child modules."; "Docs conflict: The release note says warnings occur when a deprecated output is referenced. The current output reference specifies that only module consumers see the deprecation reason, and limits the argument to child-module outputs. The current docs are for v1.16.x; no v1.15-specific output reference was found to verify whether behavior differs."
