terraform/internal/command/format
Martin Atkins 096cddb4b7 command/format: Limitation of plans.ResourceInstanceDeleteBecauseNoModule
This is an explicit technical debt note that our plan renderer isn't able
to give a fully-specific hint in this particular case of deletion reason.

This reason code means that at least one of the module instance keys in
the resource's module path doesn't match an instance declared in the
configuration, but the plan data structure doesn't retain enough
information to know which is the first step in the path which refers to
a missing instance, and so we just always return the whole thing.

This would be confusing if we return module.foo[0].module.bar not being
in the configuration as a result of module.foo not using "count"; it would
be better to say "module.foo[0] is not in the configuration" instead.

It would be most ideal to handle all of the different situations that
ResourceInstanceDeleteBecauseWrongRepetition's rendering does, so that we
can go further and explain exactly _why_ that module instance isn't
declared anymore.

We can do neither of those things today because only the Terraform Core
"expander" component knows that information, and we've discarded that
by the time we get to rendering a plan. To fix this one day would require
preserving in the plan information about which module instances are
declared, as a separate sidecar data structure from which resource
instances we're taking actions on, and then using that to identify which
step in addr.Module here first selects an invalid instance.
2021-12-13 10:04:15 -05:00
..
diagnostic.go command/views/json: Never generate invalid diagnostic snippet offsets 2021-06-28 13:42:28 -07:00
diagnostic_test.go update to use typed sensitive marks 2021-06-25 12:49:07 -04:00
diff.go command/format: Limitation of plans.ResourceInstanceDeleteBecauseNoModule 2021-12-13 10:04:15 -05:00
diff_test.go cli: Fix nested single and map diff rendering 2021-11-19 15:48:10 -05:00
difflanguage_string.go cli: Refactor resource drift rendering 2021-09-16 15:22:37 -04:00
format.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
object_id.go unmark object ID or Name for formatting 2021-08-17 12:24:43 -04:00
object_id_test.go unmark object ID or Name for formatting 2021-08-17 12:24:43 -04:00
state.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
state_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
trivia.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00