Open speller opened 3 years ago
Can confirm same behavior on t3 instance types.
In the case of a route53 update, you can quiesce by running the apply 2x and the ip address will get updated on the A record.
Facing the same issue on every operation that requires instance shutdown. For example, updating the user metadata. The instance is updated but TF doesn't care about the changed IP address so any code that is relying on it will fail or produce broken infrastructure. Why this severe bug is not being fixed?
Jumping on the bandwagon here, can confirm this is still the behavior under terraform 1.2.6 with aws provider 4.27.0.
I still got this issue. May I know how to fix it?
I still got this issue. May I know how to fix it?
In many cases, a workaround is to run the apply again, which will see the updated IP and update dependent resources/outputs/etc.
+1 using cf provider for dns
This issue seems to be a duplicate of #6781.
The workaround using an intermediate data
source posted in https://github.com/hashicorp/terraform-provider-aws/issues/6781#issuecomment-607839534 seems to work for this particular issue. That same user later posted a staged workaround that would also work, and could be needed if one has other issues. The run-apply-twice is simple, but one must remember to do it.
@ArkadyDR Yes, this is a duplicate. But who cares?
@jwoytek Can't test it right now, but changes in instance metadata still don't trigger the instance IP address change in Terraform.
Still affected by this bug 3 years after it was reported.
I have the following piece of the configuration:
The idea here is that the record must have the instance's public IP address. And it worked well. Then I changed the instance type to
t2.nano
and Terraform has created the following plan:You may see here that TF has changed the instance instead of replacing it. In the reality, the instance is replaced and gets a new public IP address. But this change is not reflected in the plan and after executing, the infrastructure becomes broken because the DNS record remains to have an old invalid IP address.
Terraform Version
1.0.3 Docker
Expected Behavior
EC2 instance is replaced in TF state. Route 53 record is updated with the new instance's IP address.
Actual Behavior
EC2 instance is not replaced in TF state. Route 53 record is not updated with the new instance's IP address.