-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Spot fleet request doesn't kill spawned instances on a destroy #10083
Comments
I see in the source where terminate_instances_with_expiration is used to decide to terminate the instances. I have this set. For some reason they aren't being killed. Wonder if it could be related to my lifecycle {} settings. |
I confirm the same issue, my terraform code snippet is provided in another opened issue #11161 Not even sure if it's terraform provider issue, or AWS not killing instances when a spot-fleet request was cancelled. Update: Unfortunately, in the documentation, I didn't find any property on what to do during Destroy action Any suggestions? it is really a big problem, as termination cannot be automated in the pipeline, or I will have to hook up some custom python script to kill instances before running terraform termination |
Found solution: |
Also, Terraform docs for iam_fleet_role describe the correct behaviour: spot instances should be terminated if the fleet request is cancelled (which is happening with terraform destroy) or when the Spot fleet request expires, if you set terminateInstancesWithExpiration. AWS expose a different parameter to terminate the running spot instances when cancelling a spot fleet request, TerminateInstances |
Is there any progress on this issue? |
Confirm, terraform 0.12.24 cancels spotfleet and terminates instances when |
I have submitted a small change that should rectify this #17268 This basically adds I'd need to work on test for this PR but the gist of the change is there. |
This functionality has been released in v4.12.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
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. |
Community Note
Terraform Version
0.12.8
aws provider version 2.23
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
Terraform destroy completes and all instances spawned by spot fleet request are terminated
Actual Behavior
Spot fleet request is cancelled but instances remain
Steps to Reproduce
terraform apply
terraform destroy
The text was updated successfully, but these errors were encountered: