-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
ec2 instance detroyed and created on every apply #7221
Comments
Hi @simplyaldo! Thanks for opening an issue. From the plan, it looks like the security groups are forcing a new resource here. I know @catsby did a ton of work around security groups recently, so hopefully he is the best person to spot what is going on here! |
Hey @simplyaldo – in v0.6.15 we added a backwards incompatible change such that Instance in a VPC need to use the Here all you need to do is change this:
to this:
Sorry for the trouble! |
Sorry again for the surprise :/ |
Could be worth changing the example on https://www.terraform.io/docs/providers/aws/r/instance.html |
Before, the EC2 instances were recreated on any apply. See hashicorp/terraform#7221
Agree with @zachgatesak; the documentation does not make sense. If |
The docs should also specify that using |
Thanks @catsby this resolved the issue! |
vpc_security_group_ids = ["${aws_security_group.tomcat.id}"] even i use this the instance is recreating for every apply |
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. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Hi there,
I have been using terraform for the last two weeks now. So far I have used terraform to build my AWS VPC and launch two instances in it. My trouble is that every time a do a
terraform plan
, terraform tells me that it would be destroy and recreate those two instance andterraform apply
does it.Terraform Version
I am using the latest terraform version
Affected Resource(s)
Terraform Configuration Files
Here is snippet from my
instances.tf
configuration file.Debug Output
I set
TF_LOG=TRACE
in order to capture data for debugging.Here is the output, it really lengthy ==> https://gist.github.com/simplyaldo/05de4a494953a4592da4c3b21e6af483
Expected Behavior
Ideally terraform should just tell me that there are no updates to be applied.
Actual Behavior
But instead terraform tells me that it needs to destroy and recreate the two ec2 instances and update a route tables when there has absolutely no changes to the instances and the route table.
Here is the output of
terraform plan
Steps to Reproduce
steps required to reproduce the issue
terraform plan
terraform apply
The text was updated successfully, but these errors were encountered: