Skip to content
Back to skills

Terraform Knowledge Patch

ASecurity

Terraform / OpenTofu

  • 25 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 5, 2026
developmentsqlexpressawsazureterraformtestingrefactoringapidatabasebackend

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill terraform-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Terraform Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Terraform Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-terraform-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-terraform-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: terraform-knowledge-patch
description: Terraform / OpenTofu
version: null
license: MIT
metadata:
  author: Nevaberry
---

# Terraform / OpenTofu compatibility

Load this skill when changing Terraform or OpenTofu configurations, upgrading
backends or automation, writing tests, implementing providers, or working with
Terraform Stacks and HCP Terraform. Use the topic references for complete
examples and product-specific conditions.

> [!CAUTION]
> Prerelease guidance is marked in the references and may change before stable release.

## Reference index

| Reference | Topics |
| --- | --- |
| [Backends, encryption, and security](references/backends-encryption-and-security.md) | Encryption, credentials, locking, installation, platforms, security fixes |
| [CLI, automation, and output](references/cli-automation-and-output.md) | Initialization, plans, queries, policies, JSON, console, graphs, formatting |
| [Language and modules](references/language-and-modules.md) | Module sources, provider selection, validation, sensitivity, ephemeral values, actions |
| [State, import, and refactoring](references/state-import-and-refactoring.md) | State compatibility, imports, generated configuration, moves, retention, replacements |
| [Testing](references/testing.md) | Inputs, mocks, overrides, parallel runs, cleanup, reports |
| [Provider Plugin Framework](references/provider-plugin-framework.md) | Function APIs, schemas, identities, ephemeral resources, write-only attributes, lists, actions |
| [Stacks and HCP Terraform](references/stacks-and-hcp.md) | Components, deployments, policies, agents, registry publishing, migration, usage |

## Breaking changes and upgrade checks

### Backend credentials and locking

OpenTofu 1.8 removes `use_legacy_workflow` from the S3 backend. Remove it from
the backend block and `-backend-config` inputs; the backend uses the SDK
credential lookup order. Terraform 1.10 removes deprecated top-level S3
role-assumption settings; move them into `assume_role`.

For Terraform's S3 backend, `AWS_USE_FIPS_ENDPOINT` and
`AWS_USE_DUALSTACK_ENDPOINT` must use literal `true` or `false` to select the
setting in 1.15; a nonempty string such as `1` no longer enables it.

OpenTofu 1.10 changes PostgreSQL backend locking incompatibly with older
clients. Upgrade all clients using that database together or move them to
separate databases. Mixing versions can allow conflicting writes.

For the OpenTofu AzureRM backend upgrade in 1.11, remove ignored `endpoint`,
`ARM_ENDPOINT`, and `msi_endpoint`; replace `ARM_MSI_ENDPOINT` with
`MSI_ENDPOINT`; choose at most one of `environment` and `metadata_host`.
Run `tofu init -reconfigure` to load the updated backend settings.

### State compatibility and local state selection

Terraform 1.7 records input validation results in state again. Readers on
Terraform 1.3, 1.4, or 1.5, including `terraform_remote_state`, need at least
1.3.10, 1.4.7, or 1.5.7 within the corresponding series.

Terraform 1.10 deprecates `-state` for `plan`, `apply`, and `refresh`.
Set `path` in the `local` backend to select the state file.

### Installation, transport, and file handling

Terraform 1.15.4 blocks provider installation into symlinked directories.
Use a real directory as the installation destination.

Upgrade to Terraform 1.15.9 if relying on `.terraformignore` to exclude
files from HCP Terraform or Terraform Enterprise uploads: Unicode normalization
could cause excluded files to be uploaded (CVE-2026-14978).

Terraform 1.16 provisioners honor `bastion_host_key`. Verify that the
configured key matches the bastion's host key before upgrading.

OpenTofu 1.12 warns about `type = "winrm"` for `file` and `remote-exec`;
removal is planned for 1.13. Migrate those connections to OpenSSH for Windows.

For custom S3 endpoints in OpenTofu 1.12, `s3::http://` uses plaintext HTTP.
Use `s3::https://` to keep those downloads on HTTPS. Official AWS hostnames
continue to use HTTPS.

### Module and expression compatibility

When `main.tofu` and `main.tf` share a directory, OpenTofu loads
`main.tofu` and skips the entire `main.tf`. Put declarations still needed
by OpenTofu in `main.tofu` or a different configuration file.

Terraform checks filesystem function results during apply. Keep the files
stable from plan through apply. Terraform 1.13.5 allows changes in provider
configurations and fixes false `templatefile` consistency errors involving
impure functions.

In OpenTofu 1.11, `issensitive` returns unknown for an unknown argument.
Base `count` or `for_each` on a plan-time-known value if those arguments
previously depended on the sensitivity of an unknown value.

## State, imports, and lifecycle

A Terraform `moved` block can change resource type when the target resource's
provider supports conversion from the source type. Check the target provider's
supported pairs. Supported moves can cross providers.

A Terraform `import` block can use a provider-defined `identity` object for
resource types supporting identity imports; set exactly one of `identity`
or `id`. Its `for_each` cannot reference the resource targeted by that block.
Build the collection from an independent input, local value, or data source.

Terraform 1.16 allows `import` blocks in the child module declaring the
resource. Terraform 1.16.1 processes separate import blocks targeting different
instances of the same resource using `for_each` or `count`.

Replace a Terraform module block with a `removed` block and
`lifecycle { destroy = false }` to drop its resources from state while keeping
the infrastructure. Review the removal in the plan before applying it.

Terraform resource `lifecycle.destroy = false` prevents resource destruction.
OpenTofu resource `lifecycle.destroy = false` drops the object from state
and leaves the remote object in place. For OpenTofu, use
`tofu destroy -suppress-forget-errors` when intentional forgetting should
allow the destroy command to exit successfully.

## Module inputs, providers, and secrets

Terraform module `source` and registry `version` accept expressions from
inputs declared `const = true` and locals resolvable during initialization.
Pass the inputs with `terraform init -var` or `-var-file`. Starting in
Terraform 1.15.5, dynamic `version` can evaluate to `null` to omit the constraint.

OpenTofu module sources, registry versions, and backend settings can use inputs
and locals that resolve during initialization, before resource, data source,
or child-module outputs are available. An aliased OpenTofu provider can use
`for_each`; select an instance by indexing that alias.

Terraform 1.17.0 supports input variables and locals in `required_providers`,
including a local value for a provider's version constraint.

Terraform reads ephemeral resources anew in each evaluation phase and keeps
their values out of saved plans and state. Inputs and child-module outputs can
declare `ephemeral = true`. `ephemeralasnull` replaces ephemeral parts with
ordinary nulls while preserving the type and non-ephemeral parts.

A Terraform provider-defined write-only argument accepts ephemeral or ordinary
values, sends them to the provider, and omits them from saved plans and state.
Increment the provider's separate version argument, when available, to make
rotation visible in the plan and trigger the update.

OpenTofu 1.11 supports ephemeral inputs, child-module outputs, resources,
and provider-defined write-only managed-resource arguments. Ephemeral resources
can supply short-lived credentials to providers or provisioners without saving
those values in plans or state.

OpenTofu encryption at rest is configured under `terraform.encryption`.
`TF_ENCRYPTION` overrides corresponding file settings. Set `enforced = true`
in `state` or `plan` to require encryption even if the environment setting
is absent. Referenced inputs and locals must resolve at init time, before state
and provider-defined functions are available.

For plaintext migration, keep an `unencrypted` fallback until `tofu apply`
rewrites state; then remove the fallback and enable enforcement. For rotation,
keep the original method and key provider available through `fallback` until
the rewrite succeeds.

## Tests and cleanup

In Terraform tests, `override_during = plan` makes mock or override values
available to runs using `command = plan`; the default is
`override_during = apply`. Overrides can target managed resource, data source,
or child-module instances with real or mock providers.

Use `state_key` to select a Terraform test run's state: equal keys share state.
`parallel = true` opts in at test-file or run level. Runs can overlap when
they use separate state and neither depends on the other's outputs.
`terraform test -parallelism=4` limits operations within each run.

Move Terraform test provider version constraints from `.tftest.hcl` provider
blocks to `required_providers` in the configuration under test.
External `variable` declarations in test files are optional, but complex
external values can produce diagnostics without them when upgrading to 1.13.

`terraform test -junit-xml=test-results.xml` writes a JUnit report.
`terraform test -verbose` shows expected diagnostics. Terraform 1.17.0
allows `mock_provider` to supply ephemeral resource values.

Terraform tests ignore `lifecycle.prevent_destroy` during cleanup. In alpha
builds, test runs can load backend state and use `skip_cleanup = true`;
failed cleanup saves state and a manifest under `.terraform`.
`terraform test cleanup` retries cleanup of the saved local state.

## CLI automation and resource discovery

In `terraform show -json` for a plan, `applyable` indicates whether automation
should offer apply. `complete` indicates whether apply is expected to reach
the desired state; if present and false, plan and apply again toward convergence.

Terraform `list` blocks in `*.tfquery.hcl` filter existing infrastructure.
`terraform query` displays matches and can generate import configuration;
`terraform validate -query` checks query files offline.

Terraform 1.17.0 standard builds accept `-policies` on `plan`, `apply`, and
`query` without `-allow-experimental-features`. Query output includes
`Unknown` and `N/A` policy results in human-readable and JSON forms.
`terraform query` rejects non-directory policy paths before invoking the engine.

OpenTofu `-json-into=FILENAME` writes the same data as `-json` to another
destination while retaining human-readable stdout. For streaming JSON commands,
a named pipe or `/dev/fd/N` lets a consumer read events during execution.

## Provider implementations and Stacks

Framework write-only attributes require `WriteOnly: true` with `Required: true`
or `Optional: true` and `Computed` false. Read the value from request
configuration; prior, planned, and final state carry null for that attribute.
The provider reference contains nested-schema restrictions and identity APIs.

Framework provider deferral requires checking `ClientCapabilities` before
setting `Deferred` and requires a supporting prerelease Terraform client.
Framework state stores remain experimental until Terraform's `state_store`
support is generally available.

Stacks use `component` declarations in `.tfcomponent.hcl` and `deployment`
declarations in `.tfdeploy.hcl`. Deployments use the same components with
their own inputs and isolated state. Stacks can produce partial plans when
required values are unknown.

GA deployment groups replace beta orchestration rules. Default groups are
available on all HCP Terraform plans; custom groups with auto-approval checks
require HCP Terraform Premium.

Files in this skill

  • SKILL.md9.9 KB
  • coverage.json2.7 KB
  • references/backends-encryption-and-security.md11.3 KB
  • references/cli-automation-and-output.md5.7 KB
  • references/language-and-modules.md9.6 KB
  • references/provider-plugin-framework.md6.4 KB
  • references/stacks-and-hcp.md5.1 KB
  • references/state-import-and-refactoring.md5.1 KB
  • references/testing.md4.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.