Commit Graph

16 Commits

Author SHA1 Message Date
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
James Bardin c1efe351b2 update taint command example
Fix the example to match the usual shell style, and add a note about
different shells requiring different escaping formats.
2020-10-05 20:38:47 -04:00
Chris Carpenter 8f4f181151
Update taint.html.markdown
Single qoute cause an `Invalid character` error.
2020-05-29 08:13:02 -05:00
Martin Atkins 2423f266fb website: example of "terraform taint" with a grandchild module
I've seen folks ask about how to express this in resource address syntax
a number of times now, so adding this example here to illustrate how it
looks when there are multiple levels of module to traverse through.

This is redundant with other information further up the page, but having
it as an entirely separate example gives an opportunity to include more
introductory text to explain what the example is showing.
2019-11-11 10:12:11 -08:00
Pam Selle 5070ab7989
Merge pull request #23185 from scott1138/patch-1
Update taint docs - for_each
2019-10-31 13:16:53 -04:00
Pam Selle 22ae5cf52d Quote differently so render works 2019-10-28 13:04:38 -04:00
scott1138 c6baf28508
Update taint docs - for_each
Provide an explanation of how to taint a resource created with for_each
2019-10-24 14:53:45 -05:00
Pam Selle 91b5343d2f
Merge pull request #22626 from mixmatch/patch-1
Update output
2019-10-18 10:21:57 -04:00
Pam Selle 0e1f12e570 Add some context for the addition 2019-09-19 16:46:12 -04:00
Pam Selle 740c9865f3 Add an example with string keys to taint to demonstrate escaping quotes 2019-09-19 13:40:29 -04:00
Daniel Petty 4fc3ea6e09
Update output 2019-08-28 11:47:14 -06:00
Ben Drucker e8996e065e website: fix <ul> formatting in "taint" doc 2019-08-19 16:30:16 -07:00
David Liao 97ad35f90c website: Update taint command docs to reflect new 0.12 usage 2019-06-03 15:36:38 -07:00
Sitatirev, Xul ad9e32f1f4
Fix documentation
It looks like the output does not match the command, in fact.
This pull-request fixes this issue.
2018-07-22 23:59:53 +02:00
Joe Winter b6a464c521 Provide example for terraform taint documentation (#15873)
* Provide example to taint documentation

Provides an example (with similar formatting as
https://www.terraform.io/docs/commands/state/list.html#example-filtering-by-module)
for tainting resources within a module.

* Add documentation for tainting a single resource
2017-08-22 13:47:30 -05:00
Martin Atkins 7ed70bb00e website: new filesystem layout for core/provider split
This repo now contains only the core docs, with other content moving elsewhere.
2017-06-13 11:25:32 -07:00