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

feature request: update aws_instance resource to support declaring Shutdown behavior #2130

Closed
ketzacoatl opened this issue May 29, 2015 · 8 comments

Comments

@ketzacoatl
Copy link
Contributor

AWS instances can be configured to either stop or terminate when they shutdown. I do not see this documented https://terraform.io/docs/providers/aws/r/instance.html. The antithesis to this is supporting the termination protection flag. Thanks for considering!

@catsby
Copy link
Contributor

catsby commented May 29, 2015

Hey @ketzacoatl thanks for writing in.
Are you suggesting a stopped state, but still visible / tracked in Terraform, or stop as a "destroyed" state, such that we'll run Delete in TF, which will actually stop the instance, and then TF will remove it from state?

At first pass that seems like we'd be leaving resources dangling (maybe not a big deal to some), with no way to re-connect Terraform to that instance. Running plan would then want to create a new instance.

Is that the behavior you're thinking of? If there are others, please mention them and we'll think about things here.

Thanks!

@catsby
Copy link
Contributor

catsby commented May 29, 2015

I may have introduced confusion here by implying some kind of state management here (running vs. stopped). Re-reading and discussing, I think you simply meant the InstanceInitiatedShutdownBehavior property in the API for running an instance (documented here). Is that correct?

Additionally, termination protection was recently added to the project in #1988 , which will be included in the next release of Terraform (should be in the next week or so).

@ketzacoatl ketzacoatl changed the title feature request: update aws_instance resource to support declaring stop behavior feature request: update aws_instance resource to support declaring Shutdown behavior May 29, 2015
@ketzacoatl
Copy link
Contributor Author

Hi @catsby, yes, I am referring to the InstanceInitiatedShutdownBehavior property in the API. I could have been more clear with a link to docs, sorry.

Thank you also for the reference to the support for termination protection, I see similar functionality also in the lifecycle docs and will try to make use of it.

As for this feature with the Shutdown behavior, if I guess if the instance is stopped, TF could ignore it, but might need to update/refresh state if the user starts the instance back up (out of band from TF). Similarly, if the instance is set to terminate on shutdown, and a fresh would show it as gone, and by default would try to re-create it. For the use cases I have, I would combine this with a conditional that allowed me to control when the new instance was re-created.

@pschultz
Copy link

We also want support for this option in Terraform, and would expect Terraform to re-create instances that have been terminated between two runs.

We're exploring the use of Terraform for our build process. During the build, we want Terraform to launch a number of build slaves and configure them to poweroff after N minutes (AWS would then terminate them). If during those N minutes another build is triggered, the slaves already exist and the provisioner resets the poweroff timer.

@tamsky
Copy link
Contributor

tamsky commented Jul 18, 2015

We ... would expect Terraform to re-create instances that have been terminated between two runs.

+1 to simply exposing the InstanceInitiatedShutdownBehavior API element, and treating missing resources like any other.

@stack72
Copy link
Contributor

stack72 commented Dec 11, 2015

@catsby / @jen20 / @phinze this can be closed. This is already in place

@phinze
Copy link
Contributor

phinze commented Dec 14, 2015

My favorite kind of notification. ❤️ @stack72

@phinze phinze closed this as completed Dec 14, 2015
@ghost
Copy link

ghost commented Apr 29, 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.

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

Successfully merging a pull request may close this issue.

6 participants