Closed devforfu closed 4 years ago
This is actually a Terraform limitation. It doesn't really track provider changes, so when you change regions, you get some very odd behavior.
It tries to create the second instance instead, and fails with error due to same ID or something.
The failure is either Terraform trying to delete the instance IDs from the old region in the new one, which will fail since those IDs don't exist in the new region, or from trying to deploy the AMI ID in the new region, as AMI IDs are also region specific.
@brikis98 Ok, understood, thank you for the explanation.
Terrform maintain the state in s3 bucket as backend. Please check if there is already some existing state in the bucket. if it is failing rename the key and try again.
I believe the question here was answered, so closing.
Not sure if that's an expected behavior or kind of bug, but when I change an AWS region after the first instance was already deployed, the old instance is not deleted.
Here is an example. Consider the script from the 2nd chapter:
If you run
terraform apply
everything is fine. If you change anything, then these changes will be detected. However, try to replace region with something else like:In this case,
terraform plan
doesn't say that one instance is destroyed and a new one created. It tries to create the second instance instead, and fails with error due to same ID or something.Probably this moment should be mentioned somewhere in the book if this issue still exists in new versions of the Terraform, or probably the "provider" section is not covered with guarantee of being idempotent?