Commit Graph

27071 Commits

Author SHA1 Message Date
James Bardin 8cef62e455 add state to plans.Plan
Since the refreshed state is now an artifact of the plan process, it
makes sense to add it to the Plan type, rather than adding an additional
return value to the Context.Plan method.
2020-09-17 09:54:59 -04:00
James Bardin 7b178b1788 add a way to selectively write to RefreshState
All resources use EvalWriteState to store their state, so we need a way
to switch the states when the resource is refreshing vs when it is
planning. (this will likely change once we factor out the EvalNode pattern)
2020-09-17 09:54:59 -04:00
James Bardin ad22e137e6 Get the new RefreshState into the right contexts 2020-09-17 09:54:59 -04:00
James Bardin d6a586709c Add RefreshState to the eval context
Since plan uses the state as a scratch space for evaluation, we need an
entirely separate state to store the refreshed resources values during
planning. Add a RefreshState method to the EvalContext to retrieve a
state used only for refreshing resources.
2020-09-17 09:54:59 -04:00
James Bardin be757bd416 Refresh instances during plan
This change refreshes the instance state during plan, so a complete
Refresh no longer needs to happen before Plan.
2020-09-17 09:54:59 -04:00
Kristin Laemmert 02fb28eeae
build: put codecov in informational mode (#26271)
While we like codecov, and the coverage goals, we've frequently ignored
the failures for various reasons. These have confused community members
submitting PRs and it can be confusing to look at a list of merged PRs
with the big X indicating failed checks ("confusing" isn't really a
problem, but if there were actually a bad merge, it could be hard to
find which in a list of commits actually had an important failure).

Fixes a mild inconvenience.
2020-09-17 08:13:50 -04:00
Alisdair McDiarmid e1a41daf9b terraform: Test sensitive values in module inputs
Passing a sensitive value as a module input variable should preserve its
sensitivity for the plan.
2020-09-16 16:54:04 -04:00
Alisdair McDiarmid 9e340ab85b terraform: Expand sensitive variable plan test
Test that the changes which use the sensitive variable have
corresponding path value marks. Also remove the unrelated validate
function from this test.
2020-09-16 16:48:28 -04:00
Alisdair McDiarmid 803c95e552
Merge pull request #26105 from hashicorp/alisdair/more-interpolation-only-expression-deprecations
configs: More interpolation-only expr deprecations
2020-09-16 16:06:45 -04:00
Kristin Laemmert 67d441b131
terraform: refactor ProviderEvalTree (#26236)
* remove leftover debug line

* terraform: refactor ProviderEvalTree

This PR refactors the ProviderEvalTree by folding the entire tree into
straight-through code in NodeApplyableProvider Execute (formally
EvalTree). The EvalConfigProvider functions were refactored into
NodeApplyableProvider functions (since that was the only place they were
used).

I also removed the unused node_provider_disabled code.

* revert removal of graphNodeCloseProvider EvalTree, replace with Execute
2020-09-16 12:17:17 -04:00
Alisdair McDiarmid 150702c100
Update CHANGELOG.md 2020-09-16 11:51:17 -04:00
Alisdair McDiarmid b5ef33b715
Merge pull request #26239 from jceresini/master
Add support for scopes to terraform login
2020-09-16 11:50:01 -04:00
Alisdair McDiarmid 3c6239f4c5
Merge pull request #26244 from hashicorp/alisdair/credentials-helper-no-credentials
website: Credentials helper response for no creds
2020-09-16 11:36:43 -04:00
James Bardin 696290e481
Merge pull request #26264 from hashicorp/jbardin/evaluate-destroy
allow evaluation of 0 instances during apply
2020-09-16 11:35:33 -04:00
Kristin Laemmert 55d58cb8be
terraform: NodeDestroyResourceInstance refactor (#26246)
* terraform: remove unused eval node

* add UpdateStateHook function to replace EvalUpdateStateHook

* early exit error isn't

* terraform: NodeDestroyResourceInstance refactor

This PR refactor's NodeDestroyResourceInstance EvalTree() into an
Execute() node. EvalRequireState and evalWriteEmptyState were used only
by this node, and they have been removed in favor of straight code.

There are still many calls to someEvalNode.Eval() in NodeDestroyResourceInstance: I plan on refactoring the remaining EvalTree()s before tacking those Eval()s (all of which are used by many graph nodes)

I've added a new function, UpdateStateHook, that is effectively the same
as EvalUpdateStateHook. The latter will be removed when the larger
EvalNode refactor project is complete.
2020-09-16 11:33:55 -04:00
Kristin Laemmert f64d5b237c
terraform: refactor nodeModuleVariable and NodeRootVariable EvalTree()s (#26245)
EvalModuleCallArguments is now a method on nodeModuleVariable, it's only
caller, and the other functions have been replaces with straight through
code (or in the case of evalVariableValidations, a standalone function).

I was unable to add tests for nodeModuleVariable.Execute, which requires
fixtures that aren't part of the MockEvalContext (a scope.evalContext is
one); it's not ideal but that function should be well covered by the
context tests so I chose to leave it as-is.

Finally, I removed the unused function hclTypeName. Deleting code is
fun!
2020-09-16 11:32:48 -04:00
James Bardin 5c69cf0851
Merge pull request #26263 from hashicorp/jbardin/cbd-from-state
always check the CreateBeforeDestroy value from state
2020-09-16 11:32:29 -04:00
James Bardin 7156649336 allow evaluation of 0 instances during apply
While this was easier to spot during plan, it is also possible to
evaluate resources with 0 instances during apply as well.

This doesn't effect the failure when scaling CBD instances, it only
changes the fact that the inconsistent value is no longer unknown.
2020-09-16 11:18:23 -04:00
James Bardin a6dffa89a3 cleanup unused CBD code
Remove the check for CreateBeforeDestroyOverride which can't happen in a
destroy node.

Remove the unnecessary GraphNodeAttachDestroyer interface, since we
don't use it now that plans can record the create+destroy order.
2020-09-16 11:14:36 -04:00
James Bardin 67fd32db7e improve failing test
Correct the initial test state, and expand the test to cause a cycle
without the previous fix.
2020-09-16 10:38:41 -04:00
James Bardin 2ea921f915 destroy nodes must rely on the state cbd status
When there is only a destroy node, there is no descendent to check for
"forced CBD", so we can only rely on the state to verify.
2020-09-16 09:52:48 -04:00
Joe Ceresini 04b39372b0 Add scopes support to password grant type 2020-09-15 19:32:41 -04:00
Joe Ceresini 2ffa84a4de Add command/login test for scopes 2020-09-15 19:30:48 -04:00
Kristin Laemmert 7b2f66c403
Update CHANGELOG.md 2020-09-15 14:21:18 -04:00
Kristin Laemmert acd8230013
vendor: upgrade go-userdirs library to fix openBSD crash (#26249)
Fixes #26175
2020-09-15 14:14:25 -04:00
Pam Selle 81a6cde3cf
Merge pull request #26203 from hashicorp/pselle/deprecate-vendor-provisioners
Deprecate vendor (3rd party) provisioners
2020-09-15 13:52:10 -04:00
Alisdair McDiarmid b395887775
Update CHANGELOG.md 2020-09-15 10:04:49 -04:00
Alisdair McDiarmid e183163739
Merge pull request #25856 from remilapeyre/consul-split-state
Split the state in chunks when they outgrow the limit of Consul KV store
2020-09-15 10:00:25 -04:00
Alisdair McDiarmid aa8c73cd18 website: Credentials helper response for no creds
For a credentials helper plugin to be useful with Terraform 0.13+, we
need to cope with the case of having no credentials for a host without
this being an error. This is to allow the public Terraform Registry to
be accessed without supplying a token.

The way to implement this is to respond to queries for credentials for a
host which has no credentials stored with an empty object and a success
exit code. This contradicts the previous documentation, which calls for
an error response in this case.
2020-09-15 09:00:44 -04:00
Kristin Laemmert f5bce1bd39
terraform: refactor graphNodeImportState and graphNodeImportState (#26243)
EvalTrees

The import EvalTree()s have been replaced with Execute +
straight-through code, which let me remove eval_import_state.go.

graphNodeImportStateSub's Execute() function is still using the
old-style (not-refactored) calls to EvalRefresh and EvalWriteState;
those are being saved for a later refactor once all (or at least most)
of the EvalTree()s are gone.

I've added incredibly basic tests for both Execute() functions; they are
only enough to verify basics - the real testing happens in
context_import_test.go.
2020-09-14 16:53:37 -04:00
Brian Flad db2b710776
docs/function/timestamp: Mention Time Provider (#26232)
This utility Terraform Provider has resources designed to handle and store time information by participating normally in the graph.
2020-09-14 16:40:36 -04:00
Joe Ceresini 9eabe22d52 Update vendor folder 2020-09-14 14:19:12 -04:00
Joe Ceresini 2acb7fac9f Include scopes in login URL 2020-09-14 12:21:20 -04:00
Alisdair McDiarmid b9a77fb214
Update CHANGELOG.md 2020-09-14 10:25:51 -04:00
Alisdair McDiarmid 712b143a63
Merge pull request #26189 from hashicorp/alisdair/console-formatter
repl: Improved value renderer for console outputs
2020-09-14 10:23:25 -04:00
Alisdair McDiarmid 7086e23bea
Merge pull request #26181 from hashicorp/alisdair/cli-config-implied-local-mirror-directories
website: Fix docs for implied provider FS mirrors
2020-09-14 10:23:09 -04:00
Alisdair McDiarmid 8b2b569d6e repl: Improved value renderer for console outputs
Use a slightly modified value renderer from terraform-provider-testing
to display values in the console REPL, as well as outputs from the apply
and outputs subcommands.

Derived from code in this repository, MIT licensed:

https://github.com/apparentlymart/terraform-provider-testing

Note that this is technically a breaking change for the console
subcommand, which would previously error if the user attempted to render
an unknown value (such as an unset variable). This was marked as an
unintentional side effect, with the goal being the new behaviour of
rendering "(unknown)", which is why I changed the behaviour in this
commit.
2020-09-14 09:47:12 -04:00
James Bardin 84438d377f
Merge pull request #26192 from hashicorp/jbardin/lost-cbd
Use saved plan to determine CreateBeforeDestroy status
2020-09-14 08:46:55 -04:00
Kristin Laemmert 7b510c4add
Mildwonkey/node resource validate (#26206)
* terraform: refactor signature of EvalContext.InitProvisioner

Nothing was using the returned provisioners.Interface, so I simplified
the signature.

* terraform: remove provisioner-related EvalTree()s

The various Evals in eval_provisioner were removed from all callers and
replaced with straight-through code.

`NodeValidatableResource.EvalTree()` to `Execute()` was more involved. I
chose to leave the `EvalValidateResource` and `EvalValidateProvisioner`
Eval functions mostly as-is, changing the main function to `.Validate` to
make it clear that these are no longer eval nodes. Eventually I expect
to rename the file (perhaps to just Validate).
2020-09-14 08:43:14 -04:00
Alisdair McDiarmid b213ec883d
Merge pull request #26221 from hashicorp/alisdair/enable-consul-remote-backend-tests
build: Enable Consul remote backend tests
2020-09-11 14:53:13 -04:00
Petros Kolyvas 2167f92096
website: Adding a note around data-sources and depends_on for 0.12 users (#26222)
* Adding not about data-sources and depends-on for 0.12 users

* Bold

* A little more markdown

* A little more markdown for data_sources in 0.12

* Some iteration based on good feedback
2020-09-11 15:16:05 -03:00
Alisdair McDiarmid 579e0b20e1 build: Enable Consul remote backend tests 2020-09-11 12:56:37 -04:00
Pam Selle 6a126df0c6
Merge pull request #26183 from hashicorp/pselle/sensitive-values
Add sensitive attribute to variables
2020-09-11 11:24:18 -04:00
Alisdair McDiarmid 36ae9647fc
Update CHANGELOG.md 2020-09-11 11:21:10 -04:00
Pam Selle 20ee878d0e Updates and improvements to comments 2020-09-11 11:15:44 -04:00
Alisdair McDiarmid 92abaadc02
Merge pull request #25842 from remilapeyre/consul-path-slash
Sanitize lock path for the Consul backend when it ends with a /
2020-09-11 11:14:49 -04:00
Alisdair McDiarmid 838182ccc9
Merge pull request #26209 from hashicorp/alisdair/upgrade-cli
vendor: Upgrade mitchellh/cli
2020-09-11 10:56:49 -04:00
Alisdair McDiarmid 1b1b17d7c7
Update CHANGELOG.md 2020-09-11 10:55:05 -04:00
Alisdair McDiarmid 549f595c04
Merge pull request #26184 from hashicorp/alisdair/required-providers-validation
configs: Error on invalid required_providers attrs
2020-09-11 10:53:05 -04:00
Pam Selle 8d8389da74 Add diff test with a sensitive change
Adds a diff test for a changed value,
and modifies the diff file to cover variable
diffs on sensitive values
2020-09-10 16:45:31 -04:00