-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
feat(aws_instance): add ignore_ami_changes option #209
Conversation
@@ -171,6 +171,10 @@ resource "aws_instance" "default" { | |||
tags = module.this.tags | |||
|
|||
volume_tags = var.volume_tags_enabled ? module.this.tags : {} | |||
|
|||
lifecycle { | |||
ignore_changes = var.ignore_ami_changes ? [ami] : [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe variables are supported in lifecycle blocks in terraform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Well, that's what I get by not testing things properly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments
Thanks for the pr @Lawstorant. Instead of updating the module, have you considered simply setting the Also have you folks considered using an autoscaling group of 1 instance to have more control over the EC2s ? It might be better for your purposes. |
My problem is that I'm setting the ami input already, but the input data comes from a filter in a data source. Well, I'm going to filter it better and close this for now. |
what
Allow ignoring AMI image ID changes. EC2 instance won't be recreated If the AMI image id is provided from a data source changes.
why
We use an aws_ami data Blocks that always provides the most recent version of selected image but that will cause the EC2 to recreate if the image is updated. We want to be able to upgrade only when we see fit.