Skip to content
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

Tags get lost as part of an instance destroy & recreate #464

Closed
wilb opened this issue Oct 20, 2014 · 5 comments
Closed

Tags get lost as part of an instance destroy & recreate #464

wilb opened this issue Oct 20, 2014 · 5 comments

Comments

@wilb
Copy link

wilb commented Oct 20, 2014

As a result of my instances being dropped & recreated, I've just noticed that none of them had their tags re-applied when recreated. I think this is probably due to them no longer being unique as the old hosts still have the tags but are in a "Terminated" state.

Maybe on instance destruction the tags should either be deleted or have a timestamp appended to them so that they are available to reuse? I've worked around the current situation by renaming the old tags manually & re-applying through terraform.

@seanherron
Copy link
Contributor

I haven't experienced this - you are referring to ec2 tags, correct? Are you terminating the instances via Terraform or via the AWS console?

@wilb
Copy link
Author

wilb commented Oct 20, 2014

I'm referring to EC2 tags, yep. Terraform terminated my instances for me as a result of #463 and recreated them in one fell swoop. As such I then had two copies of each instance showing in the AWS console - all of my "Terminated" ones had the Name tags, all the new ones that had been re-provisioned were missing tags.

@wilb
Copy link
Author

wilb commented Oct 20, 2014

Just to clarify how I re-tagged the instances:

Renamed the old tags to have "-deleted" as a suffix through the AWS console
sed -i 's/tags/#tags/' *.tf
terraform apply
sed -i 's/#tags/tags/' *.tf
terraform apply

@mitchellh
Copy link
Contributor

Reproduced this with a basic aws_instance and changing the security group.

@mitchellh
Copy link
Contributor

Fixed!

@ghost ghost locked and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants