Commit Graph

3116 Commits

Author SHA1 Message Date
Pam Selle eb2a027684
Merge pull request #26518 from hashicorp/pselle/sensitive-experiment
Remove sensitive_variables experiment
2020-10-08 16:14:37 -04:00
James Bardin f5361286cc fix tests that happened during the cleanup 2020-10-08 14:58:43 -04:00
James Bardin 57a47d0b82
Merge pull request #26519 from hashicorp/jbardin/FIXME
Cleanup and remove legacy types from test mocks
2020-10-08 14:54:40 -04:00
James Bardin a0caed541d remove legacy ApplyFn from mock provisioner 2020-10-08 13:13:13 -04:00
James Bardin 177797100d remove old mock validateFn 2020-10-08 12:43:46 -04:00
James Bardin ea5ee39f38 remove old mock provider ConfigureFn 2020-10-08 12:26:12 -04:00
James Bardin 0a6853a3f8 replace testDiffFn and testApplyFn
Replace the old mock provider test functions with modern equivalents.
There were a lot of inconsistencies in how they were used, so we needed
to update a lot of tests to match the correct behavior.
2020-10-08 11:47:34 -04:00
Pam Selle bc57c20d10 Remove sensitive_variables experiment
Ahead of the beta, remove the sensitive_variable experiment
and update tests accordingly
2020-10-08 11:22:20 -04:00
Pam Selle ece9f8c1f4
Merge pull request #26507 from hashicorp/pselle/sensitive-vars-change
Update state when sensitivity changes
2020-10-07 15:39:07 -04:00
Pam Selle a927e88c06 Compare before and after paths completely 2020-10-07 14:58:43 -04:00
Pam Selle 2c352ef182 Apply should not communicate w provider if only sensitivity changes
If sensitivity changes, we have an update plan,
but should avoid communicating with the provider
on the apply, as the values are equal (and otherwise
a NoOp plan)
2020-10-07 13:30:35 -04:00
Kristin Laemmert d2e999ba1f
remove unused code (#26503)
* remove unused code

I've removed the provider-specific code under registry, and unused nil
backend, and replaced a call to helper from backend/oss (the other
callers of that func are provisioners scheduled to be deprecated).

I also removed the Dockerfile, as our build process uses a different
file.

Finally I removed the examples directory, which had outdated examples
and links. There are better, actively maintained examples available.

* command: remove various unused bits

* test wasn't running

* backend: remove unused err
2020-10-07 11:00:06 -04:00
Pam Selle 7c2ec1640a Tidy eval_diff assignments and update plan action
When the sensitivity has changed, we want to write to
state and also display to the user that the sensitivity
has changed, so make this an update action. Also
clean up some assignments, since Contains traverses the val
anyway, this is a little tighter.
2020-10-07 10:59:28 -04:00
Pam Selle 33cbf2698d Typo fix in eval_variable 2020-10-07 10:58:05 -04:00
James Bardin ca7b5bc28b dead code 2020-10-07 10:50:21 -04:00
James Bardin 8d5e844158 no need to loop this test any longer 2020-10-07 10:47:09 -04:00
Pam Selle 7a7ad23113
Merge pull request #26491 from hashicorp/pselle/sensitive-vals-out-modules
Consider sensitivity when evaluating module outputs
2020-10-07 09:55:03 -04:00
James Bardin 35714e61e6 audit graph builder to make them more similar
Auditing the graph builder to remove unused transformers (planning does
not need to close provisioners for example), and re-order them. While
many of the transformations are commutative, using the same order
ensures the same behavior between operations when the commutative
property is lost or changed.
2020-10-06 17:39:53 -04:00
James Bardin a32028aeed evaluate vars and outputs during import
Outputs were not being evaluated during import, because it was not added
to the walk filter.

Remove any unnecessary walk filters from all the Execute nodes.
2020-10-06 17:22:50 -04:00
Pam Selle b9eeba0da2 Consider sensitivity when evaluating module outputs
This change "marks" values related to outputs that
have Sensitive set to true.
2020-10-06 13:09:18 -04:00
James Bardin 8049d2e028 do not evaluate module variables during import
We do not currently need to evaluate module variables in order to
import a resource.

This will likely change once we can select the import provider
automatically, and have a more dynamic method for dispatching providers
to module instances. In the meantime we can avoid the evaluation for now
and prevent a certain class of import errors.
2020-10-06 12:51:28 -04:00
James Bardin c48af3f18b
Merge pull request #26470 from hashicorp/jbardin/inverse-destroy-references
Allow special-case evaluation of instances pending deletion.
2020-10-05 16:20:22 -04:00
James Bardin ee564a5ceb
Merge pull request #26421 from hashicorp/jbardin/ignore-changes-map
allow ignore_changes to reference any map key
2020-10-05 12:06:05 -04:00
James Bardin 0c72c6f144 s/FullDestroy/IsFullDdestroy/ 2020-10-05 10:50:25 -04:00
James Bardin e35524c7f0 use existing State rather than Change.Before
The change was passed into the provisioner node because the normal
NodeApplyableResourceInstance overwrites the prior state with the new
state. This however doesn't matter here, because the resource destroy
node does not do this. Also, even if the updated state were to be used
for some reason with a create provisioner, it would be the correct state
to use at that point.
2020-10-05 10:40:14 -04:00
James Bardin a1181adca4 remove unused method stub 2020-10-05 10:35:31 -04:00
Pam Selle 69b03ebf42
Merge pull request #26379 from hashicorp/pselle/sensitive-nested-block-support
Support sensitivity within nested blocks
2020-10-02 17:28:15 -04:00
Martin Atkins 593cf7b4d5 didyoumean: move from "helper" to "internal"
This new-ish package ended up under "helper" during the 0.12 cycle for
want of some other place to put it, but in retrospect that was an odd
choice because the "helper/" tree is otherwise a bunch of legacy code from
when the SDK lived in this repository.

Here we move it over into the "internal" directory just to distance it
from the guidance of not using "helper/" packages in new projects;
didyoumean is a package we actively use as part of error message hints.
2020-10-02 13:35:07 -07:00
James Bardin 32681190ca
Merge pull request #26458 from hashicorp/jbardin/data-ref-index
data sources with indexed references to managed resources
2020-10-02 13:27:28 -04:00
Pam Selle f35b530837 Update compatibility checks for blocks to not use marks
Remove marks for object compatibility tests to allow apply
to continue. Adds a block to the test provider to use
in testing, and extends the sensitivity apply test to include a block
2020-10-02 13:11:55 -04:00
Pam Selle 3e7be13dff Update ordering for marking/unmarking and asserting plan valid
Update when we unmark objects so we can assert the plan is valid,
and process UnknownAsNull on the unmarked value
2020-10-02 13:03:11 -04:00
James Bardin 95197f0324 use EvalSelfBlock for destroy provisioners
Evaluate destroy provisioner configurations using only the last resource
state value, and the static instance key data.
2020-10-02 12:38:51 -04:00
James Bardin 43c0525277 fix the test that was supposed to break
The test for this behavior did not work, because the old mock diff
function does not work correctly. Write a PlanResourceChange function to
return a correct plan.
2020-10-02 08:50:24 -04:00
James Bardin 07af1c6225 destroy time eval of resources pending deletion
Allow the evaluation of resource pending deleting only during a full
destroy. With this change we can ensure deposed instances are not
evaluated under normal circumstances, but can be references when needed.
This also allows us to remove the fixup transformer that added
connections so temporary values would evaluate in the correct order when
referencing destroy nodes.

In the majority of cases, we do not want to evaluate resources that are
pending deletion since configuration references only can refer to
resources that is intended to be managed by the configuration. An
exception to that rule is when Terraform is performing a full `destroy`
operation, and providers need to evaluate existing resources for their
configuration.
2020-10-01 17:11:46 -04:00
James Bardin ac526d8d5d always load instance state when -refresh=false
The loading of the initial instance state was inadvertently skipped when
-refresh=false, causing all resources to appear to be missing from the
state during plan.
2020-10-01 16:04:35 -04:00
James Bardin 78322d5843 data depends_on with indexed references
If a data source refers to a indexed managed resource, we need to
re-target that reference to the containing resource for planning.  Since
data sources use the same mechanism as depends_on for managed resource
references, they can only refer to resources as a whole.
2020-10-01 14:10:09 -04:00
James Bardin 2376b3c5ee
Merge pull request #26444 from hashicorp/jbardin/value-checks
Add some log warnings and remove dead code
2020-10-01 09:37:56 -04:00
James Bardin ad0b81de81 allow ignore_changes to reference any map key
There are situations when a user may want to keep or exclude a map key
using `ignore_changes` which may not be listed directly in the
configuration. This didn't work previously because the transformation
always started off with the configuration, and would never encounter a
key if it was only present in the prior value.
2020-10-01 09:36:36 -04:00
Kristin Laemmert 90588c036b
terraform: minor cleanup from EvalTree() refactor (#26429)
* Split node_resource_abstract.go into two files, putting
NodeAbstractResourceInstance methods in their own file - it was getting
large enough to be tricky for (my) human eyeballs.

* un-exported the functions that were created as part of the EvalTree()
refactor; they did not need to be public.
2020-10-01 08:12:10 -04:00
James Bardin 98b568ad01 remove unused refresh node
There is no longer a refresh walk, so we no longer use this type.
2020-09-30 18:04:40 -04:00
James Bardin c52672cbbe log inconsistencies during refresh
We can't make these errors because there's no way to exempt legacy
providers from the check, but we can at least log them for
troubleshooting.
2020-09-30 17:40:39 -04:00
James Bardin b464bcbc5d copy the refreshed state at the end of plan
Otherwise we may end up with the same state value for the state and
refreshState when re-using the context.
2020-09-30 12:14:37 -04:00
James Bardin 8dc6f518c2 don't use same state in Validate for refreshState 2020-09-30 12:14:37 -04:00
James Bardin 8c699fbe32 Unsynchronized maps in test 2020-09-30 12:14:31 -04:00
James Bardin bdef106a8b WithPath should only modify the copy 2020-09-30 11:50:50 -04:00
Kristin Laemmert c258e8efbb
Merge pull request #26413 from hashicorp/mildwonkey/the-rest-of-the-owl-tree
The Last Chapter in our Epic Saga: `EvalTree()` Refactor
2020-09-30 10:48:03 -04:00
James Bardin a78d75ccfb
Merge pull request #26387 from hashicorp/jbardin/ignore-changes-2
Fix handling of ignore_changes
2020-09-29 15:35:29 -04:00
Kristin Laemmert 0ac53ae3ed terraform: remove deprecated or unused Eval() bits 2020-09-29 15:01:24 -04:00
Kristin Laemmert 184893d1e4 evaltree refactor 2020-09-29 14:31:20 -04:00
Kristin Laemmert c66494b874 terraform: refactor NodeDestroyDeposedResourceInstanceObject and NodePlanDeposedResourceInstanceObject
The various Eval()s will be refactored in a later PR.
2020-09-29 13:26:50 -04:00