I'm performing refactoring in a few Terraform files. One of the tasks is renaming resources from kebab-case to snake_case.
To prevent the destruction and recreation of said resources, I used terraform state mv
. Now, for some reason I'm hoping to understand here, it still destroys resources. I see 2 issues:
1- The IDs get computed again.
2- The references to variables are taken as literals.
Example:
-/+ aws_volume_attachment.att_ebs_caldat_axon_apps (new resource required)
id: "vai-4287143552" => <computed> (forces new resource)
device_name: "/dev/xvdb" => "/dev/xvdb"
force_detach: "true" => "true"
instance_id: "i-0ca294d44635d3ace" => "${module.instance_axon.instance_id}" (forces new resource)
volume_id: "vol-0298f5247bb2aa312" => "${aws_ebs_volume.ebs_caldat_axon_apps.id}" (forces new resource)
I'm using Terraform 0.11.14
The command for moving the state for this resource was terraform state mv aws_volume_attachment.att-ebs-caldat-axon-apps aws_volume_attachment.att_ebs_caldat_axon_apps
I don't know what I'm missing. Any help is appreciated.