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

Add support for user_data_replace_on_change field #132

Open
nk9 opened this issue Jul 25, 2022 · 0 comments
Open

Add support for user_data_replace_on_change field #132

nk9 opened this issue Jul 25, 2022 · 0 comments
Labels
bug 🐛 An issue with the system

Comments

@nk9
Copy link

nk9 commented Jul 25, 2022

Describe the Bug

The aws provider changed behavior in version 4. Previously, changes to the user_data field of an ec2 instance caused the instance to be torn down and recreated. Now, the user_data will be updated but the instance won't be recreatead. This means that, in most cases, the user_data script will not be run until the user somehow manually recreates the instance. If the user knows what's going on, they might choose to mark the instance for recreation using taint before or -replace on apply.

The change is discussed here and the field user_data_replace_on_change was added to aws_instance to provide the old behavior for those who wanted it.

Expected Behavior

I'd expect to be able to use this new field to continue having the longstanding behavior when the user_data is changed.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create an instance using user_data or user_data_base64
  2. Apply the change so the instance shows up
  3. Change the user_data
  4. Re-apply
  5. Notice that the instance has not been recreated.

Environment (please complete the following information):

Anything that will help us triage the bug will help. Here are some ideas:

$ terraform version
Terraform v1.2.5
on darwin_arm64
+ provider registry.terraform.io/hashicorp/archive v2.2.0
+ provider registry.terraform.io/hashicorp/aws v4.23.0
+ provider registry.terraform.io/hashicorp/cloudinit v2.2.0
+ provider registry.terraform.io/hashicorp/local v2.2.3
+ provider registry.terraform.io/hashicorp/null v3.1.1
+ provider registry.terraform.io/hashicorp/random v3.3.2
+ provider registry.terraform.io/hashicorp/tls v4.0.0
@nk9 nk9 added the bug 🐛 An issue with the system label Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant