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

provider/digitalocean: Making user_data force a new droplet #3740

Merged
merged 1 commit into from Nov 4, 2015

Conversation

stack72
Copy link
Contributor

@stack72 stack72 commented Nov 3, 2015

Fixes #3734

user_data is only run on instance first boot, therefore, changing the user_data will have no effect unless the instance is recreated. This follows the same behaviour as an AWS Instance

There is no way in the Digital Ocean UI to change the user_data. So it requires an instance to be recreated

Added an acceptance test to prove that it destroys and then recreates:

make testacc TEST=./builtin/providers/digitalocean TESTARGS='-run=DigitalOceanDroplet_UpdateUserData' 2>~/tf.log
go generate ./...
TF_ACC=1 go test ./builtin/providers/digitalocean -v -run=DigitalOceanDroplet_UpdateUserData -timeout 90m
=== RUN   TestAccDigitalOceanDroplet_UpdateUserData
--- PASS: TestAccDigitalOceanDroplet_UpdateUserData (76.95s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/digitalocean   76.965s

"foobar foobar"),
),
},
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to prove this was accomplished by a recreate and not an update, I think you'll need to have two different droplet variables and ensure that their IDs are different.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phinze I must admin that I am not quite sure how I would do that :)

Any pointers to places that do that already in the codebase?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries! I'll pull this in as is, tweak it, and highlight you on the commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - this is certainly something that will be useful going forward as I introduce tests when I make changes :)

@phinze
Copy link
Contributor

phinze commented Nov 4, 2015

This sounds good to me! And it matches up with equivalent behavior from other providers.

One proposed addition to the test and then this is good to go. 👍

phinze added a commit that referenced this pull request Nov 4, 2015
provider/digitalocean: Making user_data force a new droplet
@phinze phinze merged commit 94d9031 into hashicorp:master Nov 4, 2015
@stack72 stack72 deleted the f-do-userdata-new branch November 4, 2015 21:09
@ghost
Copy link

ghost commented Apr 30, 2020

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.

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

Successfully merging this pull request may close these issues.

DigitalOcean provider should replace a droplet when the userdata is changed
2 participants