-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DNS record not updated when public IP changes due to instance type change #6781
Comments
+1 on this issue. Hit the problem just a few mins ago. This issue was the first hit in search. It's more than just |
Use of |
This issue persists in Terraform v0.12.1 with v2.13.0 of the AWS provider. |
Experienced this as well. This is likely because the instance reboots (or stop starts) to effect the instance size change and that changes the public ip (and thus the dns name). Terraform v0.12.6 |
The "workaround" is to terraform apply (resize) -> wait for it.. -> terraform apply (change dns record). |
Still an issue on v0.12.8 :( |
Still an issue on terraform v0.12.24 with aws provider v2.55.0. Indeed, when a reboot is involved (in my case was also because of an update on the instance type) |
I think I have a better one... WORKAROUND: Use a "middle-man" data source. So, instead of, say...
...use this:
It seems the underlying "data" management code doesn't try to be as "clever" as others and forces a full "recalculation" of its contents only after the upstream resource (the aws instance, in this case) is fully updated. This way, since the aws_instance.example is changed, the associated datasource gets "recalculated" and the final dependent resource (a DNS record in this case) ends up with the proper value instead of the old one. |
Ran into this today with terraform 0.12.25 and AWS provider 2.70.0. Any hope of a real fix here? |
Did my approach helped you? In the meantime, I found the same kind of problem in other situations so, in the end, I went with a different workaround (over same logical basis). So... the problem is certain resources are not updated enough in advance? When are they going to be updated? By the end of Instead of running Terraform twice, I move those resources to a different "stage" meant to be run secuentially. I.e.:
(note 10-run-first and 20-run-after are not terraform modules but independent runs: you are meant to Since I'm already using shared remote states, it's a matter of adding the proper outputs for the resources I'll be using later to 10-run-first and capturing them on 20-run-after by means of a terraform_remote_state data resource. More cumbersome, but guaranteed to work no matter what. |
Hi, we still have this issue. Is it going to be a real fix for that ? |
+1 We are also still facing this issue. |
Four years have passed but the Terraform still produces invalid non-functional environments... Shame... |
The suggested workaround doesn't work in my case. The instance is updated in-place in the plan:
But this doesn't trigger the route record update even if the instance is referred through the Sucks... I love Terraform and hate it. Hate for many issues of this kind which are not solved for many years... At the moment when you think that you've won the fight with a known issue, TF immediately brings you new problems... |
I think that the Terraform team should at least add a disclaimer somewhere that under some simple circumstances, TF with all its power is unable to link an AWS instance and route53 record. The documented bug is a feature (c). |
It seems the only workaround is to use the |
Hey! I'm also facing this issue in a similar case when changing the instance state via resource. Attempted to use the data solution, but, unfortunately, it did not work out by itself in my case, probably due to me not changing the aws_instance itself. Found out a hack that, if the data attribute depends on a resource that will be directly changed (in my case – instance state), it will wait for it to be provisioned before reading the values. Terraform:
Plan:
Initially also tried depending directly within aws_route53_record but unfortunately it did not work. And, adding the dependency within aws_instance creates a circular dependency. Agreed that ideally this would be resolved within Terraform itself. |
Thank you for the workaround @jklusis! I was experiencing the same issue, and your solution worked for me 😄 |
almost 6 years and nobody cares... |
🤞 this should be a case of setting |
Warning This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them. Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed. |
This functionality has been released in v5.83.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
This issue was originally opened by @wayneworkman as hashicorp/terraform#19578. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform Version
Terraform v0.11.10
I have an ec2 instance that gets assigned a public IP, and a route53 resource that creates a CNAME record pointing at that ec2 instance's dns name.
I updated the ec2 instance from a t3.nano to t3.micro. This resulted in the instance stopping, changing it's type, and then starting up. The instance's public IP changed due to the stop/start, but the route53 record was not updated with the new DNS name.
Expected Behavior
Terraform should have updated the dns record.
Actual Behavior
Terraform did not update the dns record.
How to reproduce
Run this, which makes an instance with a public IP and a DNS record for it.
Then change the instance type to something else, and apply.
The text was updated successfully, but these errors were encountered: