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

# sincecutoff.com /t/opentofu — OpenTofu

- name: OpenTofu
- kind: cli
- children: none
- homepage: <https://github.com/opentofu/opentofu>

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=opentofu`](https://sincecutoff.com/v1/changes.md?tool=opentofu) (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).

### OpenTofu v1.13 includes early linting work (2026-09-30)
- slug: opentofu-v1-13-includes-early-linting-work-a1e6ef97148d
- score: 0.95

How to use it:

When applying built-in lint checks to a configuration, run `tofu validate -lint=all` from its directory. Linting is experimental, and findings appear as warnings.

Examples:

```
tofu validate -lint=all
```

- why_it_matters: Apply built-in linting checks to an OpenTofu configuration.
- sources: <https://github.com/opentofu/opentofu/releases/tag/v1.13.0>, <https://opentofu.org/docs/v1.13/cli/commands/validate/>, <https://opentofu.org/docs/v1.13/language/linting/>
- gotchas: "Version: v1.13"; "Availability: Experiment"; "-lint=all: Opts in to linting; accepts a comma-separated list of rule or group identifiers. `all` selects all rules. Identifiers are case-sensitive; unknown identifiers are ignored."; "Prerequisite: Use OpenTofu v1.13 or later; the documented core lint rules are marked as introduced in v1.13."; "Prerequisite: `tofu validate` requires an initialized working directory with referenced plugins and modules installed. Initialize without accessing the configured backend with `tofu init -backend=false`."; "Prerequisite: Linting is experimental and opt-in; detected issues are shown as warning diagnostics."; "The release describes the linting work as very early."

### OpenTofu commands support simultaneous UI and JSON output (2026-05-14)
- slug: opentofu-commands-support-simultaneous-ui-and-json-output-fa066f210608
- score: 0.97

How to use it:

When a supported command needs both human-readable UI and machine-readable output, run it with `-json-into=<filename>` to save JSON while keeping the UI on standard output.

Examples:

```
tofu plan -json-into=<JSON_FILE>
```

- why_it_matters: Use machine-readable output to supplement the normal OpenTofu UI while implementing or debugging a tool that interprets command output.
- before: Previously, commands that supported both output formats could be run with only one or the other.
- sources: <https://github.com/opentofu/opentofu/releases/tag/v1.12.0>, <https://opentofu.org/blog/dual-command-output-streams/>, <https://opentofu.org/docs/v1.12/intro/whats-new/>
- gotchas: "Version: v1.12.0"; "-json-into=<FILENAME> (required): Writes the same machine-readable output as `-json` to the given file, allowing simultaneous human-readable and machine-readable output."; "Prerequisite: Use a command that supports both human-oriented UI and machine-readable JSON output."; "Applies to commands that support both human-oriented UI output and machine-readable JSON output."

### OpenTofu dynamic `prevent_destroy` lifecycle setting (2026-05-14)
- slug: opentofu-dynamic-prevent-destroy-lifecycle-setting-855276222c2a
- score: 0.99

How to use it:

When a managed resource’s destroy protection should follow a module value, set `lifecycle.prevent_destroy` to a same-module expression such as `var.prevent_destroy_database` (available in OpenTofu v1.12.0).

Examples:

```
variable "prevent_destroy_database" {
  type    = bool
  default = true
}

resource "example_database" "example" {
  # ...
  lifecycle {
    prevent_destroy = var.prevent_destroy_database
  }
}
```

- why_it_matters: Configure a managed resource so its destroy protection follows a module value.
- sources: <https://github.com/opentofu/opentofu/releases/tag/v1.12.0>, <https://opentofu.org/docs/v1.12/language/resources/behavior/>, <https://opentofu.org/docs/v1.12/language/values/variables/>
- gotchas: "Version: v1.12.0"; "lifecycle.prevent_destroy: Boolean lifecycle argument; when true, OpenTofu errors on plans that destroy the associated object. In v1.12.0 it can be set dynamically from same-module values."; "prevent_destroy_database: Example input variable of type `bool`; its default is true, making it optional to callers. Child-module callers pass its value in the module block."; "Prerequisite: Use OpenTofu v1.12.0 or later for dynamically defined `prevent_destroy`."; "Prerequisite: Declare any referenced input variable in the same module; the example uses `type = bool`."; "The referenced values must be available elsewhere in the same module."
