Open fritz-net opened 3 days ago
Hi @fritz-net,
Thanks for filing the issue! Terraform should return an error there, since locals.old_token
is not a valid from
address.
Hey @jbardin,
thanks for confirming. I was hoping that it is a valid option and the comparison is just somehow "buggy" :( I solved it by doing some bash pre processing on relevant .tf files.
Could the docs then be updated? Currently they allow strings: https://developer.hashicorp.com/terraform/language/moved
Terraform Version
I also tested it with 1.7
Terraform Configuration Files
Debug Output
Expected Behavior
it should also move the resource like in the first, commented out, example:
Actual Behavior
the resource is not moved but destroyed and created
when using:
Steps to Reproduce
resource "random_password" "token_old"
instead ofresource "random_password" "token"
terraform init
terraform apply
resource "random_password" "token"
instead ofresource "random_password" "token_old"
terraform plan
Additional Context
tested in CI/CD with version 1.7 tested on windows with 1.9
The Idea behind using locals is that I can use variables inside the names of the resources. I needed this since I'm migrating away from a lib which dynamically created tf.json files and used env vars to name the resources.
References
No response