terraform/internal/command/testdata
Martin Atkins f0034beb33 core: refactoring.ImpliedMoveStatements replaces NodeCountBoundary
Going back a long time we've had a special magic behavior which tries to
recognize a situation where a module author either added or removed the
"count" argument from a resource that already has instances, and to
silently rename the zeroth or no-key instance so that we don't plan to
destroy and recreate the associated object.

Now we have a more general idea of "move statements", and specifically
the idea of "implied" move statements which replicates the same heuristic
we used to use for this behavior, we can treat this magic renaming rule as
just another "move statement", special only in that Terraform generates it
automatically rather than it being written out explicitly in the
configuration.

In return for wiring that in, we can now remove altogether the
NodeCountBoundary graph node type and its associated graph transformer,
CountBoundaryTransformer. We handle moves as a preprocessing step before
building the plan graph, so we no longer need to include any special nodes
in the graph to deal with that situation.

The test updates here are mainly for the graph builders themselves, to
acknowledge that indeed we're no longer inserting the NodeCountBoundary
vertices. The vertices that NodeCountBoundary previously depended on now
become dependencies of the special "root" vertex, although in many cases
here we don't see that explicitly because of the transitive reduction
algorithm, which notices when there's already an equivalent indirect
dependency chain and removes the redundant edge.

We already have plenty of test coverage for these "count boundary" cases
in the context tests whose names start with TestContext2Plan_count and
TestContext2Apply_resourceCount, all of which continued to pass here
without any modification and so are not visible in the diff. The test
functions particularly relevant to this situation are:
 - TestContext2Plan_countIncreaseFromNotSet
 - TestContext2Plan_countDecreaseToOne
 - TestContext2Plan_countOneIndex
 - TestContext2Apply_countDecreaseToOneCorrupted

The last of those in particular deals with the situation where we have
both a no-key instance _and_ a zero-key instance in the prior state, which
is interesting here because to exercises an intentional interaction
between refactoring.ImpliedMoveStatements and refactoring.ApplyMoves,
where we intentionally generate an implied move statement that produces
a collision and then expect ApplyMoves to deal with it in the same way as
it would deal with all other collisions, and thus ensure we handle both
the explicit and implied collisions in the same way.

This does affect some UI-level tests, because a nice side-effect of this
new treatment of this old feature is that we can now report explicitly
in the UI that we're assigning new addresses to these objects, whereas
before we just said nothing and hoped the user would just guess what had
happened and why they therefore weren't seeing a diff.

The backend/local plan tests actually had a pre-existing bug where they
were using a state with a different instance key than the config called
for but getting away with it because we'd previously silently fix it up.
That's still fixed up, but now done with an explicit mention in the UI
and so I made the state consistent with the configuration here so that the
tests would be able to recognize _real_ differences where present, as
opposed to the errant difference caused by that inconsistency.
2021-09-20 09:06:22 -07:00
..
add commands: `terraform add` (#28874) 2021-06-17 12:08:37 -04:00
apply Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-config-invalid Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-destroy-targeted Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-error Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-input Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-input-partial Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-plan-no-module Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-replace Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-sensitive-output Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-shutdown Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-targeted Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-terraform-env Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-vars Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-change Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-change-multi-default-to-single Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-change-multi-to-multi Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-change-multi-to-no-default-with-default Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-change-multi-to-no-default-without-default Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-change-multi-to-single Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-change-single-to-single Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-changed-with-legacy Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-from-state Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-inmem-locked Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-new Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-new-interp Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-new-legacy Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-new-migrate Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-new-migrate-existing Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-backend-empty Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-backend-empty-config Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-backend-match Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-backend-mismatch Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-legacy Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-legacy-data Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-local Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-local-match Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-local-mismatch-lineage Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-local-newer Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-unchanged Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-unchanged-with-legacy Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-unset Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-unset-with-legacy Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
empty Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
fmt Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
get Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
graph Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-missing-resource-config Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-module-input-variable Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-module-var-file Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-aliased Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-datasource Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-implicit Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-invalid Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-remote-state Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-var Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-var-default Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-var-file Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-backend Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-backend-config-file Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-backend-config-file-change Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-backend-config-kv Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-backend-empty Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-check-required-version Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-get Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-get-provider-detected-legacy Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-get-provider-invalid-package Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-get-provider-legacy-from-state Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-get-provider-source Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-get-providers Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-internal Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-internal-invalid Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-legacy-provider-cache Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-legacy-rc Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-provider-lock-file Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-provider-lock-file-readonly-add Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-providers-lock Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-required-providers Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
inmem-backend Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
login-oauth-server Upgrade to Go 1.17 2021-08-17 15:20:05 -07:00
login-tfe-server Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
modules Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
parallelism Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan-emptydiff Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan-invalid Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan-out-backend Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan-out-backend-legacy Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan-provider-input terraform: use hcl.MergeBodies instead of configs.MergeBodies for pro… (#29000) 2021-06-25 08:48:47 -04:00
plan-replace Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan-vars Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
providers Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
providers-lock/basic providers subcommand tests (#28744) 2021-05-19 12:56:16 -04:00
providers-schema Revert "json-output: Release format version 1.0" 2021-09-09 11:25:35 -04:00
push Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
push-backend-new Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
push-input Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
push-input-partial Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
push-no-remote Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
push-no-upload Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
push-tfvars Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
refresh Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
refresh-empty Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
refresh-output Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
refresh-targeted Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
refresh-unset-var Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
refresh-var Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
show Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
show-json core: refactoring.ImpliedMoveStatements replaces NodeCountBoundary 2021-09-20 09:06:22 -07:00
show-json-sensitive Revert "json-output: Release format version 1.0" 2021-09-09 11:25:35 -04:00
show-json-state Revert "json-output: Release format version 1.0" 2021-09-09 11:25:35 -04:00
state-list-backend-custom Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
state-list-backend-default Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
state-list-nested-modules Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
state-pull-backend Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
state-push-bad-lineage Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
state-push-good Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
state-push-replace-match Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
state-push-serial-newer Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
state-push-serial-older Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
taint-check-required-version Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
test-fails Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
test-passes Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
validate-invalid Revert "json-output: Release format version 1.0" 2021-09-09 11:25:35 -04:00
validate-valid Revert "json-output: Release format version 1.0" 2021-09-09 11:25:35 -04:00
variables Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
empty-file Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
statelocker.go Move states/ to internal/states/ 2021-05-17 14:09:07 -07:00