-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore replaced resources when creating moved blocks #84
Comments
… resources that are replaced (busser#84)
Thanks for reporting this! I believe this is a consequence of a core assumption that I'm trying to wrap my head around how - resource "random_pet" "alpha" {
+ resource "random_pet" "bravo" {
length = 2
}
- resource "random_pet" "bravo" {
+ resource "random_pet" "charlie" {
length = 3
} In this example, Terraform would plan to replace the The specific issue you describe is a bit more complex, because there is no valid order for the moves. Here's a variation on the previous example: - resource "random_pet" "alpha" {
+ resource "random_pet" "bravo" {
length = 2
}
- resource "random_pet" "bravo" {
+ resource "random_pet" "alpha" {
length = 3
} In this case, Now back to your specific case. I think the issue can be reproduced this way (I'll need to actually test this later): resource "random_integer" "alpha" {
min = 1
- max = 2
+ max = 3
}
resource "random_pet" "alpha" {
length = random_integer.alpha.result
}
resource "random_integer" "bravo" {
min = 1
- max = 2
+ max = 3
}
resource "random_pet" "bravo" {
length = random_integer.bravo.result
} In this example, both I think that the bug here isn't that This is a pretty subtle bug so I may be missing something. What is your take on this? 🤔 |
Hi Arthur, first, sorry for the late reply (we were very busy with a big (state) migration - very successful thanks to After we looked at your examples above, we believe that there are cases where the generation of moved blocks for replace actions is meaningful. But since Instead, we propose to add a parameter/flag e.g. What do you think about this proposal? |
We found another issue when using
tfautomv
.The following shows automatically created moved blocks for 2 replaced "aws_route" resources.
Which were cross-moved one to the other.
Resulting in this error:
The following is an original terraform plan output log when NOT using
tfautomv
which clearly proves thatterraform already realized that the resource address has not changed.
We believe that
tfautomv
should never act on replaced resources.In
pkg/engine/plan.go
in theSummarizeJSONPlan
function we wanted to identify the involved change actions.The "replace" results from the following
delete
andcreate
actions in combination, which we simply printed out.Because
tfautomv
acts on each delete and create individually it tries to find an unnecessary "move partner" resourceand only the other replaced one is available.
The text was updated successfully, but these errors were encountered: