tfautomv partially detected moves
DenisBY opened this issue · comments
Denis commented
I moved my state to the module. After executing tfautomv
I got:
$ tfautomv
Running "terraform init"...
Running "terraform plan"...
╷
│ Done: Added 4 moved blocks to "moves.tf".
╵
And moves.tf
contained this:
moved {
from = aws_autoscaling_group.rabbitmq
to = module.ec2-rabbitmq-cluster.aws_autoscaling_group.rabbitmq
}
moved {
from = aws_proxy_protocol_policy.rabbitmq
to = module.ec2-rabbitmq-cluster.aws_proxy_protocol_policy.rabbitmq
}
moved {
from = aws_route53_record.rabbitmq_alb
to = module.ec2-rabbitmq-cluster.aws_route53_record.rabbitmq_alb
}
moved {
from = aws_route53_record.rabbitmq_elb
to = module.ec2-rabbitmq-cluster.aws_route53_record.rabbitmq_elb
}
however, I have more moved resources.
I had to manually add the rest, i.e.:
moved {
from = aws_security_group.role-rabbitmq-nodes-sg
to = module.ec2-rabbitmq-cluster.aws_security_group.role-rabbitmq-nodes-sg
}
moved {
from = aws_security_group.rabbitmq_elb
to = module.ec2-rabbitmq-cluster.aws_security_group.rabbitmq_elb
}
moved {
from = aws_security_group.rabbitmq_alb
to = module.ec2-rabbitmq-cluster.aws_security_group.rabbitmq_alb
}
etc. 12 more moved resources.
Arthur Busser commented
By any chance, did you use the -show-analysis
flag to see what prevented tfautomv from identifying the missing moves?
Denis commented
Thanks for pointing me out. It seems it's mostly because of tags. I refactored code "a little bit".
│ module.ec2-rabbitmq-cluster.aws_lb_listener.rabbitmq_alb
│ ╷
│ │ Mismatch: aws_lb_listener.rabbitmq_alb
│ │ ╷
│ │ │ + tags_all.maintainer = "da"
│ │ │ - tags_all.maintainer = <nil>
│ │ │ + tags_all.owner = "da"
│ │ │ - tags_all.owner = <nil>
│ │ │ + tags_all.env = "acc"
│ │ │ - tags_all.env = <nil>
│ │ │ + tags_all.project = "da"
│ │ │ - tags_all.project = <nil>
│ │ ╵
│ ╵
│
│ module.ec2-rabbitmq-cluster.aws_lb_target_group.rabbitmq_alb
│ ╷
│ │ Mismatch: aws_lb_target_group.rabbitmq_alb
│ │ ╷
│ │ │ + tags_all.owner = "da"
│ │ │ - tags_all.owner = <nil>
│ │ │ + tags_all.project = "da"
│ │ │ - tags_all.project = <nil>
│ │ │ + tags_all.maintainer = "da"
│ │ │ - tags_all.maintainer = <nil>
│ │ │ + connection_termination = false
│ │ │ - connection_termination = <nil>
│ │ │ + tags_all.env = "acc"
│ │ │ - tags_all.env = <nil>
│ │ ╵
│ ╵