-
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
lifecycle ignore_changes not working on aws_instance user_data #5294
Comments
Ugh, this is kind of frightening. What version are you using? |
This still happens on 0.6.12. I think the issue has something to do with the fact that the |
+1 |
Yes this looks like the same problem, probably worth closing this issue, and tracking it there. I shall update that ticket |
Merging this issue back down with #3528 👍 we'll get this fixed up soon! |
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,
I currently have some terraform config which defines both an AWS instance as well as template which I use to provide input for user-data for cloud-init. I DO NOT want my instance to be recreated if the
user_data
changes (as this is by default only picked up the first time the instance launches in AWS, so any changes here are really irrelevant). I was trying to use thelifecycle ignore_changes
config to do this however it does not appear to be doing what I would expect and lands up wanting to recreate my instance again anyway.Before adding the
lifecycle ignore_changes
block, with the following definition:a
terraform plan -module-depth=-1
results in:(Note: explicit mention of forcing a new resource due to change in user_data which is expected)
However adding the
lifecycle ignore_changes
block as follows:And running a
terraform plan -module-depth=-1
correctly indicates (at least at initial face value anyway) that it is ignoring theuser_data
field as it is not even displayed in the output with the "forces new resource" comment HOWEVER terraform still (via the -/+) indicates it is actually going to destroy and recreate the instance, i.e. I get the following:Note: if the template does not change, then this instance is not flagged for destroy and recreate - In other words, the marking of the instance for destroy and recreate is not because of changes to any other fields (outside of the user_data template one which should, in theory be ignored)
The text was updated successfully, but these errors were encountered: