-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
aws_instance should allow to specify the instance state #7262
Comments
+1 , we have a similar use case to shutdown instances when they are not used. currently we are doing it outside of terraform through SDK. it would be good if terraform can support it |
Don't know if it makes a difference, but for my use case it's okay if state is not supported for instances being newly created. I've never had a case where an instance had to be created directly in the "stopped" state - I'm not even sure if the cloud API supports that, and I don't care TBH. However, the state semantics become important for instances that are already created, and I just want to modify their state - flipping back and forth between running and stopped. Hope that clarifies the use case I'm thinking about. |
@FlorinAndrei is correct that the underlying API does not support requesting an instance in a 'stopped' state. [RunInstances] |
+1 The over use cases can be:
|
Related to #1579. |
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. |
Terraform Version
Terraform v0.6.16
Affected Resource(s)
There seems to be no way to specify the instance state in a template. I would like to be able to do something like this:
The default value for state should be "running".
Use case: Terraform is great for creating / destroying test or development environments quickly (semi-temporary environments). But sometimes creating an environment may include a long initial step, like importing a DB from backups. If that's the case, I don't want to create the environment every morning, wait for DB to be imported, and then destroy it in the evening.
Instead, I want to create the environment today, in the morning, and wait for the DB import once. Then, at the end of the day, turn off all instances and go home. That could be accomplished by specifying the state for all instances in a global variable, and changing that variable from "running" to "stopped", then run terraform apply.
Then the next morning I'll just change the state back to "running", run terraform apply and have the environment up and running very quickly. The initial DB import would not have to be performed again every day. This would save a lot of time in such cases.
The text was updated successfully, but these errors were encountered: