OpenTofu lets you declaratively manage your cloud infrastructure.
Go to file
Alisdair McDiarmid c5c1f31db3 backend: Validate remote backend Terraform version
When using the enhanced remote backend, a subset of all Terraform
operations are supported. Of these, only plan and apply can be executed
on the remote infrastructure (e.g. Terraform Cloud). Other operations
run locally and use the remote backend for state storage.

This causes problems when the local version of Terraform does not match
the configured version from the remote workspace. If the two versions
are incompatible, an `import` or `state mv` operation can cause the
remote workspace to be unusable until a manual fix is applied.

To prevent this from happening accidentally, this commit introduces a
check that the local Terraform version and the configured remote
workspace Terraform version are compatible. This check is skipped for
commands which do not write state, and can also be disabled by the use
of a new command-line flag, `-ignore-remote-version`.

Terraform version compatibility is defined as:

- For all releases before 0.14.0, local must exactly equal remote, as
  two different versions cannot share state;
- 0.14.0 to 1.0.x are compatible, as we will not change the state
  version number until at least Terraform 1.1.0;
- Versions after 1.1.0 must have the same major and minor versions, as
  we will not change the state version number in a patch release.

If the two versions are incompatible, a diagnostic is displayed,
advising that the error can be suppressed with `-ignore-remote-version`.
When this flag is used, the diagnostic is still displayed, but as a
warning instead of an error.

Commands which will not write state can assert this fact by calling the
helper `meta.ignoreRemoteBackendVersionConflict`, which will disable the
checks. Those which can write state should instead call the helper
`meta.remoteBackendVersionCheck`, which will return diagnostics for
display.

In addition to these explicit paths for managing the version check, we
have an implicit check in the remote backend's state manager
initialization method. Both of the above helpers will disable this
check. This fallback is in place to ensure that future code paths which
access state cannot accidentally skip the remote version check.
2020-11-19 13:19:40 -05:00
.circleci switch to hashicorp docker mirror 2020-10-29 22:37:11 -04:00
.github Remove backport review teams for now 2020-11-02 10:43:22 -05:00
addrs remove LegacyProvider (#26433) 2020-10-05 08:33:49 -04:00
backend backend: Validate remote backend Terraform version 2020-11-19 13:19:40 -05:00
builtin builtin/provider/terraform: Add field descriptions 2020-11-06 08:51:07 +00:00
command backend: Validate remote backend Terraform version 2020-11-19 13:19:40 -05:00
communicator communicator/ssh: Add support for Windows targets (#26865) 2020-11-12 10:00:48 -05:00
configs configs: Emit a warning for backends in nested modules 2020-11-18 08:20:25 -08:00
dag use a single log writer 2020-10-19 14:29:54 -04:00
digraph Fix TestWriteDot random order error 2014-07-29 10:26:50 -07:00
docs docs: Provider protocol wire format for values 2020-09-01 10:40:36 -07:00
e2e command/cliconfig: Allow development overrides for providers 2020-10-16 14:31:15 -07:00
experiments Add provider sensitivity propagation experiment 2020-10-26 15:05:22 -04:00
flatmap prune references to config/module 2019-08-07 17:50:59 -04:00
helper remove LevelFilter 2020-10-19 14:31:05 -04:00
httpclient Merge pull request #22272 from hashicorp/f-httpclient-ua 2019-08-12 20:20:03 +01:00
instances Expander.ExpandResource cannot expand all modules 2020-03-25 11:58:23 -04:00
internal hide provider crashes from panicwrap when logging 2020-11-05 10:54:21 -05:00
lang lang/funcs: Experimental "defaults" function 2020-11-13 17:27:20 -08:00
moduledeps remove LegacyProvider (#26433) 2020-10-05 08:33:49 -04:00
plans don't render plan for module outputs 2020-11-17 09:31:18 -05:00
plugin make grpcErr work for either plugin type 2020-10-26 09:34:03 -04:00
providers udpate PrepareProviderConfig docs 2020-11-04 13:02:04 -05:00
provisioners provisioners: Add Factory type and FactoryFixed helper 2018-10-16 19:14:11 -07:00
registry use a single log writer 2020-10-19 14:29:54 -04:00
repl use a single log writer 2020-10-19 14:29:54 -04:00
scripts build: remove unused scripts (#26484) 2020-10-06 13:26:38 -04:00
states states: Disable Terraform version check 2020-10-28 16:52:35 -04:00
terraform terraform: Unmark provider configuration arguments 2020-11-16 13:13:20 -05:00
tfdiags tfdiags: Diagnostics.ToHCL 2020-03-12 11:11:29 -07:00
tools command/init: Read, respect, and update provider dependency locks 2020-10-09 09:26:23 -07:00
version Cleanup after v0.14.0-beta1 release 2020-10-15 14:19:40 +00:00
website backend: Validate remote backend Terraform version 2020-11-19 13:19:40 -05:00
.gitignore Coverage 2020-03-03 13:01:05 -05:00
.go-version update to go1.15.2 2020-09-23 15:18:22 -04:00
.hashibot.hcl Restore issue migrator 2020-10-09 15:41:15 -04:00
.tfdev .tfdev: remove platform build constraint 2019-08-09 15:10:52 -07:00
BUGPROCESS.md Fix formatting in BUGPROCESS.md 2020-10-07 16:40:00 -04:00
CHANGELOG.md Update CHANGELOG.md 2020-11-18 15:17:40 -08:00
checkpoint.go Remove config.go and update things using its aliases 2020-01-13 16:50:05 -05:00
codecov.yml build: Set Codecov to informational mode again 2020-10-23 15:58:33 -04:00
CODEOWNERS Updating codeowners with our deprecated status for tool-specific provisioners 2020-09-29 14:19:56 -04:00
commands.go website: Update the CLI commands index page for latest help output 2020-10-26 09:55:21 -07:00
Dockerfile switch to hashicorp docker mirror 2020-10-29 22:37:11 -04:00
go.mod command: Fix fmt to preserve blank block labels 2020-11-18 11:59:10 -05:00
go.sum command: Fix fmt to preserve blank block labels 2020-11-18 11:59:10 -05:00
help.go main: A slightly more compact presentation of the main help text 2020-10-26 09:55:21 -07:00
LICENSE Adding license 2014-07-28 13:54:06 -04:00
main_test.go main: make configuration available when initializing commands 2017-09-29 14:03:09 -07:00
main.go main: Special error message for invalid top-level command 2020-11-18 11:26:42 -08:00
Makefile remove vendor from some tooling 2020-09-23 17:06:59 -04:00
plugins.go Remove config.go and update things using its aliases 2020-01-13 16:50:05 -05:00
provider_source.go command/cliconfig: Allow development overrides for providers 2020-10-16 14:31:15 -07:00
README.md Add bug triage guide 2020-09-25 15:56:58 -04:00
signal_unix.go Forward SIGTERM and handle that as an interrupt 2016-12-08 12:20:25 -05:00
signal_windows.go Forward SIGTERM and handle that as an interrupt 2016-12-08 12:20:25 -05:00
synchronized_writers.go main: synchronize writes to VT100-faker on Windows 2017-05-04 15:36:51 -07:00
version.go states/statemgr: Fix the Filesystem state manager tests 2018-11-19 09:02:35 -08:00

Terraform

Terraform

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

The key features of Terraform 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: Terraform has a "planning" step where it generates an execution plan. The execution plan shows what Terraform will do when you call apply. This lets you avoid any surprises when Terraform manipulates infrastructure.

  • Resource Graph: Terraform builds a graph of all your resources, and parallelizes the creation and modification of any non-dependent resources. Because of this, Terraform 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 Terraform will change and in what order, avoiding many possible human errors.

For more information, see the introduction section of the Terraform website.

Getting Started & Documentation

Documentation is available on the Terraform website:

If you're new to Terraform and want to get started creating infrastructure, please check out our Getting Started guides on HashiCorp's learning platform. There are also additional guides to continue your learning.

Show off your Terraform knowledge by passing a certification exam. Visit the certification page for information about exams and find study materials on HashiCorp's learning platform.

Developing Terraform

This repository contains only Terraform core, which includes the command line interface and the main graph engine. Providers are implemented as plugins that each have their own repository in the terraform-providers organization on GitHub. Instructions for developing each provider are in the associated README file. For more information, see the provider development overview.

To learn more about compiling Terraform and contributing suggested changes, please refer to the contributing guide.

To learn more about how we handle bug reports, please read the bug triage guide.

License

Mozilla Public License v2.0