Skip to content

Commit

Permalink
Fix spot fleet request not terminating instances
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek committed Jan 24, 2021
1 parent 9e55235 commit 98635c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion aws/resource_aws_spot_fleet_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,11 @@ func resourceAwsSpotFleetRequest() *schema.Resource {
Optional: true,
ForceNew: true,
},
"terminate_instances": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"valid_from": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1631,7 +1636,7 @@ func resourceAwsSpotFleetRequestUpdate(d *schema.ResourceData, meta interface{})
func resourceAwsSpotFleetRequestDelete(d *schema.ResourceData, meta interface{}) error {
// http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CancelSpotFleetRequests.html
conn := meta.(*AWSClient).ec2conn
terminateInstances := d.Get("terminate_instances_with_expiration").(bool)
terminateInstances := d.Get("terminate_instances").(bool)

log.Printf("[INFO] Cancelling spot fleet request: %s", d.Id())
err := deleteSpotFleetRequest(d.Id(), terminateInstances, d.Timeout(schema.TimeoutDelete), conn)
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/spot_fleet_request.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ across different markets and instance types. Conflicts with `launch_template_con
* `excess_capacity_termination_policy` - Indicates whether running Spot
instances should be terminated if the target capacity of the Spot fleet
request is decreased below the current size of the Spot fleet.
* `terminate_instances` - (Optional) Whether to terminate Spot instances for
the Spot Fleet if it is deleted successfully. Defaults to `false`.
* `terminate_instances_with_expiration` - Indicates whether running Spot
instances should be terminated when the Spot fleet request expires.
* `instance_interruption_behaviour` - (Optional) Indicates whether a Spot
Expand Down

0 comments on commit 98635c2

Please sign in to comment.