tfmigrate
tfmigrate copied to clipboard
Bug when you have module that have the same resource names
I discovered the hard way while trying to move 2500+ resources that if you have that case :
- Let's assume my migrate.hcl file looks like this :
migration "multi_state" "mv_dir1_dir2" {
from_dir = "dir1"
to_dir = "dir2"
actions = [
"xmv azurerm_network_security_group.example[\"*\"] azurerm_network_security_group.example[\"$${1}\"]",
]
}
- Let's assume my state file has the following resources :
azurerm_network_security_group.example["bar"]
azurerm_network_security_group.example["baz"]
module.example.azurerm_network_security_group.example[0]
it will fail with an error that looks like : cannot find azurerm_network_security_group.example[0] in current state
I think this is because it tries to do a match of azurerm_network_security_group.example no matter if it has something else before (like module.something)
I don't think this is intended.