-
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
provider/aws/aws_instance: template_file as user_data causes instance recreation #1962
Comments
I've noticed the same thing in the scenario you describe. |
AlexanderEkdahl: What version do you use? |
v0.5.0 |
This error is fixed in master. I recommend building Terraform from source. |
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. |
Update:
Using template_file.myfile.rendered as user_data value always results in
recreation of the effected resource. The plan command shows a new hash
value for the user_data, but during the apply phase the hash value is again
the same as the old one.
For example we use a template_file to provide user_data to a new instance for
bootstrapping. The template file looks like this:
The corresponding resource definition:
The first apply looks like this:
Now we run a 'terraform plan' which refreshes that state and detects a
change in the user_data, and of course no change has been made to either
resource definition nor template_file or any of the vars:
At last we run a 'terraform apply' again and the output is the following:
As we can see the new user_data shown by the apply command is still the same, but the plan command returns a totally different one. If we would do the same again the outcome will be also the same (new hash shown by plan, during apply resource gets recreated but user_data stays the same).
The recreation is of course acceptable, if the template_file or any of its variables changed, but this is not the case here. And this is also indicated by the resource recreation during the second apply command, which also shows the same hash value as the one provided by the first apply.
The text was updated successfully, but these errors were encountered: