-
Notifications
You must be signed in to change notification settings - Fork 9k
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
start/stop instances - should close #22, #1998 and maybe #50 #1980
Conversation
🤔 🤔 🤔 |
What does "size/L" mean? |
I believe this implementation should be improved in order to use with other attributes that don't require the resource to be recreated, just state to be temporarily changed to make the changes. For example we also have the attributes user_data and ebs_optimized that require the instance to be at stopped state and the instance is recreated for them which is not necessary. One approach that I suggest is adding another setting to the attribute like ForceNew that tells which state the resource should be at before making that change. Once the changes are verified terraform checks if resource needs to be at one particular state and changes the resource first and then make the changes and returns to the original value if it's different from the required one. Ignore that if resource needs to be recreated. Maybe something that could be added to terraform core instead of aws provider. Also terraform should tell that the resource will be changed from "running" to "stopped" on this case, users should know that, when instance_type is changed now terraform shows the change like it changing while the instance is running, it doesn't show that a particular state is required and it might impact user's production environment by stopping the instance. Please let me know youf thoughts. |
@ericofusco - All good thoughts. I'm not interested in supporting this PR. If someone would like to take the code and improve it, I'll leave my branch around for them to use. In the meantime, I'll close this PR in favor of someone else taking ownership. Cheers! |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
I've added a couple acceptance tests for this feature. Since I'd already taken a stab at this about a year ago and never thought of a good way to deal with the transition from
terminated
tostopped
and don't really think it's necessary to get the brunt of the value here, I've made it so you can only setinstance_state
tostopped
orrunning
. You can even set an instance tostopped
at creation time, which might be useful for something, ¯_(ツ)_/¯. Also, while writing my tests, I realized you can't stop instances when their root block device is of typeinstance-store
. I had no idea.I haven't had a ton of luck getting my code merged into this code base, so please don't hesitate to tell me if there's something I can do to improve this PR.
Cheers!
UPDATE: Also going to reference hashicorp/terraform#1579 here so people know I did it.