Commit Graph

28616 Commits

Author SHA1 Message Date
James Bardin 0b3b84acc1 refresh state during a destroy plan
Because the destroy plan only creates the necessary changes for apply to
remove all the resources, it does no reading of resources or data
sources, leading to stale data in the state. In most cases this is not a
problem, but when a provider configuration is using resource values, the
provider may not be able to run correctly during apply. In prior
versions of terraform, the implicit refresh that happened during
`terraform destroy` would update the data sources and remove missing
resources from state as required.

The destroy plan graph has a minimal amount of information, so it is not
feasible to work the reading of resources into the operation without
completely replicating the normal plan graph, and updating the plan
graph and all destroy node implementation is also a considerable amount
of refactoring. Instead, we can run a normal plan which is used to
refresh the state before creating the destroy plan. This brings back
similar behavior to core versions prior to 0.14, and the refresh can
still be skipped using the `-refresh=false` cli flag.
2021-01-08 13:29:54 -05:00
James Bardin 3e224df379 destroy plan with provider config from data 2021-01-08 13:29:54 -05:00
James Bardin 026ba5b013 ensure context cancel is never nil
The context used for Stop is more appropriately tied to the lifetime of
the provisioner rather than a call to the ProvisionResource method. In
some cases Stop can be called before ProvisionResource, causing a panic
the provisioner.  Rather than adding nil checks to the CancelFunc call
for Stop, create a base context to use for cancellation with both Stop
and Close methods.
2021-01-08 12:36:45 -05:00
Pam Selle d175e67bc9
Merge pull request #27429 from hashicorp/pselle/staticcheck
Staticcheck fixes in terraform package
2021-01-08 11:10:40 -05:00
Alisdair McDiarmid d763e4f73e cli: Fix rendering of long integers
Recent changes to the human-readable rendering of outputs and console
values led to long integer values being presented in scientific
notation (e.g. 1.2345678e+07). While technically correct, this is an
unusual way to present integer values.

This commit changes the formatting mode to 'f', which never uses
scientific notation and displays integer values as a sequence of digits
instead (e.g. 12345678).
2021-01-08 09:38:18 -05:00
Romain Philibert 5ae5c99ba0 fix: do not fail when provider symlink is broken. Only print a warning.
fix https://github.com/hashicorp/terraform/issues/27445
2021-01-08 12:51:09 +01:00
hashicorp-ci 5132abf638 Cleanup after v0.15.0-alpha20210107 release 2021-01-07 22:07:59 +00:00
hashicorp-ci 602d13d621
Release v0.15.0-alpha20210107 2021-01-07 21:38:40 +00:00
Pam Selle bc46ff545e
Update CHANGELOG.md 2021-01-07 15:33:07 -05:00
Pam Selle c9f372a62b
Merge pull request #24896 from bendrucker/validate-ignore-empty-provider
validate: ignore providers with no configuration
2021-01-07 15:30:57 -05:00
James Bardin 751e359ee5
Merge pull request #27437 from hashicorp/jbardin/cleanup
remove unused testdata files
2021-01-07 12:55:12 -05:00
James Bardin 9b3c4159be remove unused testdata files
these are no longer referenced in any tests
2021-01-07 12:13:25 -05:00
Pam Selle fb5f7b9a59 Staticcheck fixes
Fixes within the terraform package to remove staticcheck errors
2021-01-07 10:28:40 -05:00
Robin Schulz 64f9180a3c
Update gcs.html.md
Just a typo
2021-01-07 12:21:29 +01:00
Alisdair McDiarmid 0a31fa0941
Merge pull request #27420 from hashicorp/alisdair/hcl-2.8.2
Upgrade HCL to v2.8.2
2021-01-06 12:46:29 -05:00
Chris Arcand b82e107728
Merge pull request #27424 from hashicorp/remove-confirm-destroy
Remove documentation on 'CONFIRM_DESTROY'
2021-01-06 11:34:22 -06:00
Chris Arcand 5440d9653b [skip-ci] Remove documentation on 'CONFIRM_DESTROY'
This variable mechanism was replaced long ago with a explicit `Allow
destroy plans` setting on a Terraform Cloud workspace, and no longer
does anything: https://www.terraform.io/docs/cloud/workspaces/settings.html#destruction-and-deletion

Rather than mention this new mechanism at all though, I've removed the
requisite from here entirely - the reason being that a consideration
like this is no different from other permission concerns (e.g. "You must
have Apply permission on a workspace to `apply`"), and without
enumerating _all_ of these here - which doesn't seem appropriate - we
just remove this concern entirely.
2021-01-06 10:07:31 -06:00
Alisdair McDiarmid f96c193060
Merge pull request #27412 from hashicorp/alisdair/fix-variable-validation-sensitive-value
core: Fix sensitive value variable validation
2021-01-06 09:57:34 -05:00
Alisdair McDiarmid fd79c61eb5 go get github.com/hashicorp/hcl/v2@v2.8.2 2021-01-06 09:45:38 -05:00
JohnM 72e657edcc
Chage backend.tmpl to config.tmpl in Maps example,
Reference file in Maps example is named config.tmpl, example used backend.tmpl from previous section.
2021-01-05 21:55:06 -08:00
Pam Selle 45a5a3cc73
Merge pull request #27410 from hashicorp/pselle/count-validate
De-duplicate count validate code
2021-01-05 15:51:41 -05:00
Alisdair McDiarmid afbde358fa
Merge pull request #27407 from hashicorp/alisdair/backend-disable-version-check-for-workspaces-with-local-operations
backend/remote: No version check for local ops
2021-01-05 13:53:59 -05:00
Alisdair McDiarmid 1fa65bdd91 core: Fix sensitive value variable validation
Binding a sensitive value to a variable with custom validation rules
would cause a panic, as the validation expression carries the sensitive
mark when it is evaluated for truthiness. This commit drops the marks
before testing, which fixes the issue.
2021-01-05 13:52:33 -05:00
Pam Selle dbde1be363 Update validate test to add case for marked count value
The diff here is largely a refactor to allow the test to run multiple cases
2021-01-05 11:49:35 -05:00
Pam Selle 33c31dce2b Use evaluateCountExpressionValue in validate step
There was a special, duplicate function that could be replaced by
calling evaluateCountExpressionValue, and removes duplicate code
2021-01-05 11:26:18 -05:00
Alisdair McDiarmid 7e09cd1228 backend/remote: No version check for local ops
If the remote backend is connected to a Terraform Cloud workspace in
local operations mode, we disable the version check, as the remote
Terraform version is meaningless.
2021-01-05 09:11:19 -05:00
Nick Fagerlund 5ceb8b2b98 website: Adopt `terraform_remote_state` into language docs
...and also shrink the explanation for alternate sharing approaches, a bit.

Actually, it looks like I already half-adopted it by accident. 😬 But this
commit adds it to the sidebar under "State", so users can browse to it. I'm
leaving the URL alone, because it's not urgent and we'll need to adjust a large
swath of URLs at some point anyway.

This change effectively stops presenting `terraform` as a provider in the normal
sense, and reduces /docs/providers/terraform/index.html to a ghost page in the
language section (to avoid breaking links for the time being). The message a
reader should get is that Terraform has one special built-in data source where
you don't need to think about the provider or its version.
2021-01-04 12:08:09 -08:00
Pam Selle e9748574b9
Merge pull request #27373 from stakiran/patch-1
website: Fix wrong link of operators.
2021-01-04 14:22:21 -05:00
Alisdair McDiarmid f770f03620
Merge pull request #27335 from hashicorp/alisdair/fix-sensitive-data-source-arguments
core: Fix for sensitive data source arguments
2021-01-04 13:53:35 -05:00
Alisdair McDiarmid c0a5a5be1b
Merge pull request #27319 from hashicorp/alisdair/backend-remote-no-version-check-for-operations
backend/remote: No version check for operations
2021-01-04 13:52:38 -05:00
stakiran 3ce7edc018
website: Fix wrong link of operators.
not "references.html" but "operators.html".
2020-12-27 21:15:13 +09:00
Nick Fagerlund c0e37a7ea1
Merge pull request #27339 from hashicorp/dec20_reduce_provider_indexes
website: Remove provider category indexes, reduce main list
2020-12-18 13:42:01 -08:00
Pam Selle 77c67a3963
Merge pull request #27338 from hashicorp/pselle/test-sets
[tests] Roll back test schema expansion and isolate
2020-12-18 16:28:58 -05:00
Nick Fagerlund cc6a226bcf website: Remove provider category indexes, reduce main list
As of December 18, 2020, we've redirected nearly all of the provider
documentation that used to live on terraform.io:

- For providers that got published on the Registry, we redirected each docs page
to the corresponding Registry docs page.

- For providers that never got adopted by a new publisher, we archived the
GitHub repository and redirected each docs page to the corresponding Markdown
source file on github.com. (For an example of these redirects, see
https://www.terraform.io/docs/providers/telefonicaopencloud/r/s3_bucket.html)

There are ten providers left that we haven't redirected. These ones got adopted
by new publishers and _will_ end up on the Registry, but they aren't quite ready
to ship and get their permanent redirects, and we don't want to sabotage their
SEO by 301ing to a temporary destination.
2020-12-18 13:13:45 -08:00
Pam Selle 87b576da7a Roll back test schema expansion and isolate
Isolate the test schema expansion, because having NestingSet
in the schema actually necessitates [] values in the AttrsJson.
While this didn't fail any tests on its addition, that
is scary and so isolate this to the one test using it.
2020-12-18 15:08:44 -05:00
Anthony Sottile 8cd72e51cb
fix file mode on lock file (#27205)
Signed-off-by: Anthony Sottile <asottile@umich.edu>
2020-12-18 11:51:59 -05:00
Alisdair McDiarmid 577b1ea2af core: Fix for sensitive data source arguments 2020-12-18 11:22:00 -05:00
Robin Norwood 235c141565 Add links to outputs and locals tutorials 2020-12-17 12:24:53 -08:00
Nick Fagerlund 85d477aee9 website: Fix numerous links with redirects or broken anchors
These links largely still go somewhere useful, but they have some kind of issue
revealed by our new link checker:

- Some of them point to a stale URL that redirects, and can be updated to the
  new destination.
- Some of them point to anchors that don't exist (anymore?) in the destination.
- Some of them end up redirecting unnecessarily due to how the server handles
  directory URLs without trailing slashes. Sorry, I know that's pointless, just,
  humor me for the time being so we can get our CI green. 😭

In a couple cases, I've added invisible anchors to destination pages, either to
preserve an old habit or because the current anchors kind of suck due to being
particularly long or meandering.
2020-12-17 12:23:50 -08:00
Nick Fagerlund 1fff4e2690 website: Update links to redirected provider docs pages
This commit intentionally leaves the indexes of provider docs alone, to avoid
merge conflicts when we delete those.
2020-12-17 12:23:50 -08:00
Alisdair McDiarmid a7c9e41249
Merge pull request #27320 from hashicorp/alisdair/update-deps
Update hcl and go-cty dependencies
2020-12-17 14:24:53 -05:00
James Bardin f5187aa869
Merge pull request #27318 from hashicorp/jbardin/path-marks
Correctly compare unordered sets of marks
2020-12-17 13:49:50 -05:00
Alisdair McDiarmid 908017fe69 go get github.com/zclconf/go-cty@v1.7.1 2020-12-17 13:04:53 -05:00
Alisdair McDiarmid 409c713591 go get github.com/hashicorp/hcl/v2@v2.8.1 2020-12-17 13:01:54 -05:00
Alisdair McDiarmid 619c6727ef backend/remote: No version check for operations
Terraform remote version conflicts are not a concern for operations. We
are in one of three states:

- Running remotely, in which case the local version is irrelevant;
- Workspace configured for local operations, in which case the remote
  version is meaningless;
- Forcing local operations with a remote backend, which should only
  happen in the Terraform Cloud worker, in which case the Terraform
  versions by definition match.

This commit therefore disables the version check for operations (plan
and apply), which has the consequence of disabling it in Terraform Cloud
and Enterprise runs. In turn this enables Terraform Enterprise runs with
bundles which have a version that doesn't exactly match the bundled
Terraform version.
2020-12-17 12:58:38 -05:00
James Bardin 1309b36b83 plan context test for mysterious changes
This plan would occasionally show changes when there weren't any due to
the sensitive marks being compared incorrectly.
2020-12-17 12:55:58 -05:00
James Bardin 79a31f627b compare unordered sets of PathMarkValues
When comparing marks for values during plan and apply, we need to ensure
the order of the marked paths is consistent.
2020-12-17 12:55:58 -05:00
Pam Selle 428d404d92
Allow for_each arguments containing sensitive values if they aren't keys (#27247)
* Add test for existing behavior, when a value contains a marked value

* Allow some marked values as for_each arguments

Rather than disallow values that have any marks
as for_each arguments, this makes the check more
nuanced to disallow cases where the whole value
is marked (a whole map, or any set). This allows
cases where a user may pass a map that has marked
values, but the keys are not sensitive
2020-12-17 11:27:12 -05:00
Pam Selle 1970c14a53
[docs] Add limitations section to for_each (#27299)
* Add limitations section to for_each

Move limitations from a note to their own section,
to allow for expansion on disallowing sensitive values
in for_each
2020-12-17 11:03:14 -05:00
James Bardin de114c4b7e
Merge pull request #27303 from hashicorp/jbardin/data-source-no-provider
modify ProvidedBy to indicate no provider needed for orphaned data sources
2020-12-17 09:06:52 -05:00