OpenTofu - Fork open-source de Terraform (backup)
Find a file
Martin Atkins 5fa35c5601 backend+command: Alias names for backend types
This introduces the concept of "backend aliases", which are alternative
names that can be used to refer to a given backend.

Each backend type has one canonical name and zero or more alias names. The
"backend" block in the root module can specify either a canonical backend
type or an alias, but internally OpenTofu will always track the backend
type using its canonical name.

In particular, the following are all true when the configuration specifies
an alias instead of a canonical backend type:
- The "tofu init" output includes a brief extra message saying which
  backend type OpenTofu actually used, because that is the name that we'd
  prioritize in our documentation and so an operator can use the canonical
  type to find the relevant docs when needed.
- The .terraform/terraform.tfstate file that tracks the working directory's
  currently-initialized backend settings always uses the canonical backend
  type, and so it's possible to freely switch between aliases and canonical
  without "tofu init" thinking that a state migration might be needed.
- Plan files similarly use the canonical backend type to track which
  backend was active when the plan was created, which doesn't have any
  significant user-facing purpose, but is consistent with the previous
  point since the settings in the plan file effectively substitute for
  the .terraform/terraform.tfstate file when applying a saved plan.
- The terraform_remote_state data source in the provider
  terraform.io/builtin/terraform accepts both canonical and alias in its
  backend type argument, treating both as equivalent for the purpose of
  fetching the state snapshot for the configured workspace.

The primary motivation for this new facility is to allow the planned
"oracle_oci" backend to have an alias "oci" to allow writing configurations
that are cross-compatible with HashiCorp Terraform, since that software
has chosen to have unqualified OCI mean Oracle's system, whereas OpenTofu
has previously established that unqualified OCI means "Open Container
Initiative" in our ecosystem.

In particular, this design makes it possible in principle to bring an
existing Terraform configuration specifying backend "oci" over to OpenTofu
without modifications, and then to optionally switch it to specifying
backend "oracle-oci" at a later time without a spurious prompt to migrate
state snapshots to the same physical location where they are already
stored.

This commit doesn't actually introduce any aliases and therefore doesn't
have any tests for the new mechanism because our backend system uses a
global table that isn't friendly to mocking for testing purposes. I've
tested this manually using a placeholder alias to have confidence that it
works, and I expect that a subsequent commit introducing the new
"oracle_oci" backend will also introduce its "oci" alias and will include
tests that cover use of the alias and migration from the alias to the
canonical name and vice-versa.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-09-11 11:33:53 -07:00
.github Replace AWS with local provider to fix end-to-end test on darwin_amd64 (#3224) 2025-09-03 09:04:12 -03:00
cmd/tofu cliconfig: Registry protocol retry count and timeout settings 2025-09-10 11:45:38 -07:00
contributing Updated references and moved governance stuff to a new repo opentofu/org (#2953) 2025-06-25 10:50:10 -07:00
docs Update provider for_each internal documentation (#2870) 2025-05-28 11:30:41 -04:00
internal backend+command: Alias names for backend types 2025-09-11 11:33:53 -07:00
rfc RFC: conditional enabled field (#3066) 2025-08-29 12:37:13 -03:00
scripts Fix typos (#1905) 2024-08-29 13:20:33 -04:00
testing plan diff: summarize the current -> planned notation 2025-08-26 11:37:44 -07:00
tools tfplugin5+tfplugin5: Adopt the latest protocol versions (#2817) 2025-05-19 07:00:49 -04:00
version version: this branch now represents v1.11 series development 2025-06-02 09:53:15 -07:00
website cliconfig: Registry protocol retry count and timeout settings 2025-09-10 11:45:38 -07:00
.copywrite.hcl ignore any lock file on license header check (#1776) 2024-07-08 15:27:11 +03:00
.devcontainer.json Update .devcontainer.json go's version to 1.22 (#2385) 2025-01-17 15:45:56 +01:00
.gitattributes Normalize line breaks in .tmpl files (#3232) 2025-09-02 16:08:00 -03:00
.gitignore gitignore: add coverage.out and coverage.html (#2519) 2025-02-13 19:59:28 -05:00
.go-version go.mod: Upgrade to Go 1.25 (#3166) 2025-08-22 07:10:11 -04:00
.golangci.yml Fix linting in internal/command (#2798) 2025-05-15 07:39:11 -04:00
.goreleaser.yaml More nightly build work, hardcode env vars and remove version (#3138) 2025-08-13 14:33:52 +01:00
.licensei.toml feat: add license checks on dependencies (#310) 2023-09-13 19:10:41 +03:00
.tfdev Rename github.com/placeholderplaceholderplaceholder/opentf to github.com/opentofu/opentofu (#461) 2023-09-20 14:35:35 +03:00
CHANGELOG.md CHANGELOG: New entry for opentofu/opentofu#3256 2025-09-10 11:45:38 -07:00
CHARTER.md Updated references and moved governance stuff to a new repo opentofu/org (#2953) 2025-06-25 10:50:10 -07:00
CODE_OF_CONDUCT.md Update core team email. (#752) 2023-10-19 12:03:39 +02:00
codecov.yml Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
CODEOWNERS update CODEOWNERS to match the new governance chart (#2959) 2025-06-25 12:47:24 -03:00
CONTRIBUTING.md Update CONTRIBUTING.md - Changing TSC membership (#3053) 2025-07-22 09:25:26 -07:00
CONTRIBUTING.RELEASE.md Add github workflow to run govoulncheck on all branches with supported OpenTofu versions (#2636) 2025-05-14 18:26:22 +03:00
Dockerfile OpenTofu 1.10: Disable usage of ghcr.io image as a base image (#1994) 2025-01-07 10:08:23 -05:00
Dockerfile.minimal Fixes #2356: Minimal base image (#2375) 2025-01-15 13:46:34 +01:00
go.mod go.mod: go get github.com/zclconf/go-cty@v1.17.0 2025-09-09 10:07:29 -07:00
go.sum go.mod: go get github.com/zclconf/go-cty@v1.17.0 2025-09-09 10:07:29 -07:00
GOVERNANCE.md Updated references and moved governance stuff to a new repo opentofu/org (#2953) 2025-06-25 10:50:10 -07:00
LICENSE Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
MAINTAINERS.md OpenTofu Charter and Governance (#2830) 2025-05-23 08:18:56 -04:00
Makefile Update Makefile lint version to match GitHub Actions (#3211) 2025-08-29 15:38:32 -04:00
README.md Add TSC Meeting link / info (#2847) 2025-05-23 10:00:27 -04:00
RELEASE.md Added nightly build process - Experimental (#3111) 2025-08-12 14:25:34 +01:00
SECURITY.md Added Security disclousure policy (#749) 2023-10-19 15:27:59 -07:00
tools.go add automated copyright header check (#1696) 2024-06-03 16:49:36 +03:00
WEEKLY_UPDATES.md Weekly update 2024-10-11 (#2068) 2024-10-11 15:20:00 +02:00

OpenTofu

OpenSSF Best Practices

OpenTofu is an OSS tool for building, changing, and versioning infrastructure safely and efficiently. OpenTofu can manage existing and popular service providers as well as custom in-house solutions.

The key features of OpenTofu are:

  • Infrastructure as Code: Infrastructure is described using a high-level configuration syntax. This allows a blueprint of your datacenter to be versioned and treated as you would any other code. Additionally, infrastructure can be shared and re-used.

  • Execution Plans: OpenTofu has a "planning" step where it generates an execution plan. The execution plan shows what OpenTofu will do when you call apply. This lets you avoid any surprises when OpenTofu manipulates infrastructure.

  • Resource Graph: OpenTofu builds a graph of all your resources, and parallelizes the creation and modification of any non-dependent resources. Because of this, OpenTofu builds infrastructure as efficiently as possible, and operators get insight into dependencies in their infrastructure.

  • Change Automation: Complex changesets can be applied to your infrastructure with minimal human interaction. With the previously mentioned execution plan and resource graph, you know exactly what OpenTofu will change and in what order, avoiding many possible human errors.

Getting help and contributing

Tip

For more OpenTofu events, subscribe to the OpenTofu Events Calendar!

Reporting security vulnerabilities

If you've found a vulnerability or a potential vulnerability in OpenTofu please follow Security Policy. We'll send a confirmation email to acknowledge your report, and we'll send an additional email when we've identified the issue positively or negatively.

If you believe you have found any possible copyright or intellectual property issues, please contact liaison@opentofu.org. We'll send a confirmation email to acknowledge your report.

Registry Access

In an effort to comply with applicable sanctions, we block access from specific countries of origin.

License

Mozilla Public License v2.0