terraform/internal/refactoring
Martin Atkins bdc5f152d7 refactoring: Implied move statements can be cross-package
Terraform uses "implied" move statements to represent the situation where
it automatically handles a switch from count to no-count on a resource.
Because that situation requires targeting only a specific resource
instance inside a specific module instance, implied move statements are
always presented as if they had been declared in the root module and then
traversed through the exact module instance path to reach the target
resource.

However, that means they can potentially cross a module package boundary,
if the changed resource belongs to an external module. Normally we
prohibit that to avoid the root module depending on implementation details
of the called module, but Terraform generates these implied statements
based only on information in the called module and so there's no need to
apply that same restriction to implied move statements, which will always
have source and destination addresses belonging to the same module
instance.

This change therefore fixes a misbehavior where Terraform would reject
an attempt to switch from no-count to count in a called module, where
previously the author of the calling configuration had no recourse to fix
it because the change has actually happened upstream.
2022-01-11 08:43:57 -08:00
..
testdata find implied moves in nested modules 2022-01-04 09:20:47 -05:00
move_execute.go cleanup some move graph handling 2022-01-04 09:21:36 -05:00
move_execute_test.go refactoring: Move nested modules 2021-12-21 16:25:06 -05:00
move_statement.go find implied moves in nested modules 2022-01-04 09:20:47 -05:00
move_statement_test.go find implied moves in nested modules 2022-01-04 09:20:47 -05:00
move_validate.go refactoring: Implied move statements can be cross-package 2022-01-11 08:43:57 -08:00
move_validate_test.go refactoring: Implied move statements can be cross-package 2022-01-11 08:43:57 -08:00