Commit Graph

27784 Commits

Author SHA1 Message Date
James Bardin e01d37d0dc Block.AttribuuteByPath
There are a few places where we want to perform some transformation on a
cty.Value, but require information from the schema. Rather than create
bespoke functions to walk the cty.Value and schema in concert, we can
provide Attribute information from a cty.Path allowing the use of
Value.Transform in these cases.
2021-01-12 16:31:18 -05:00
James Bardin 7dd570ef6c change mock provider to use GetSchemaResponse
This ensures that test providers are using the same types as actual
providers.
2021-01-12 16:31:18 -05:00
James Bardin 5fe848b642 change mock return values to pointers
This allows up to detect an unset value from the zero value so that
defaults can be implemented, while still allowing tests to return
specific values of their choosing.
2021-01-12 15:16:48 -05:00
Pam Selle 9371b60d71 More verbose error for whole resource move failure
When running state mv with a resource source, but the destination
fails, provide a hint that the source is a resource (not an instance)
in case the user means to address it this way
2021-01-12 13:21:25 -05:00
Pam Selle 52c77ba33e Print addresses in state mv errors
Using the addrTo after it has failed its check means <invalid>/no
address will be printed. Change this throughout, but particularly
add a test for the origin issue for this.
2021-01-12 13:05:01 -05:00
Pam Selle ae52190c01
Merge pull request #27415 from techsolx/patch-1
Chage backend.tmpl to config.tmpl in Maps example,
2021-01-12 10:43:08 -05:00
Alisdair McDiarmid f5785b43c2
Merge pull request #27440 from hashicorp/alisdair/fix-rendering-of-long-integers
cli: Fix rendering of long integers
2021-01-12 10:06:40 -05:00
Pam Selle 516ad2c8e4
Merge pull request #27432 from bulletinmybeard/patch-1
Update gcs.html.md
2021-01-11 16:19:13 -05:00
Pam Selle c806162ddd
Update CHANGELOG.md 2021-01-11 15:03:22 -05:00
Pam Selle 0d87c66211
Merge pull request #27463 from hashicorp/pselle/get-plugins
Remove get-plugins flag
2021-01-11 15:02:22 -05:00
Pam Selle d232da4077
Update CHANGELOG.md 2021-01-11 14:58:41 -05:00
Pam Selle 801f8aa0b7
Merge pull request #27461 from hashicorp/pselle/verify-plugins
Remove verify-plugins flag
2021-01-11 14:57:45 -05:00
Pam Selle e22ccd424c Add note about removal to web docs 2021-01-11 14:55:49 -05:00
Pam Selle 462caaf538
Merge pull request #27464 from hashicorp/pselle/init-lock
Remove state lock flags from init
2021-01-11 14:54:42 -05:00
James Bardin d26c149174
Merge pull request #27408 from hashicorp/jbardin/destroy-plan-refresh
Refresh during destroy
2021-01-11 14:24:28 -05:00
James Bardin 62815debbf
Merge pull request #27450 from hashicorp/jbardin/internal-provisioner-panics
provisioners: ensure context cancel is never nil in builtin provisioners
2021-01-11 12:42:53 -05:00
Kristin Laemmert 7467805cc6
Update CHANGELOG.md 2021-01-11 12:34:43 -05:00
Jacob Martin b49655724d
command: Fix terraform show not outputting child_modules properly in certain circumstances (#27352)
* Add test for module nesting without resources.

* Add test

* Fix showing resources when a module has no resources, only submodules.
2021-01-11 12:31:20 -05:00
Pam Selle bbcf6ae20b Remove state lock flags from init 2021-01-11 12:02:03 -05:00
Pam Selle 5ad6100ff3 Remove get-plugins
Remove the no-op get-plugins flag
2021-01-11 11:47:23 -05:00
Pam Selle aab0dd102d
Merge pull request #27455 from cladius/patch-1
Corrected minor typo
2021-01-11 11:40:05 -05:00
Pam Selle da5a28e6ae Remove verify-plugins flag
This flag does not do anything, and so this removes the mention in
the CLI docs and the parsing of the flag variable
2021-01-11 11:38:17 -05:00
Cladius Fernando 25003a0caa
Corrected minor typo
On Windows, the file must be named named terraform.rc => On Windows, the file must be named terraform.rc
2021-01-09 10:52:59 +05:30
James Bardin fb2208a6d9 refactor context plan
get rid of the mutation of the plans.Plan and return values.
2021-01-08 13:29:54 -05:00
James Bardin e614fb9aed refresh is expected for destroy
These tests were not previously running a refresh, and hence did not
expect the resources to be read.
2021-01-08 13:29:54 -05:00
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