diff --git a/aws/resource_aws_spot_instance_request.go b/aws/resource_aws_spot_instance_request.go index 52e5c7b4899..0a0e79b9b81 100644 --- a/aws/resource_aws_spot_instance_request.go +++ b/aws/resource_aws_spot_instance_request.go @@ -215,8 +215,8 @@ func resourceAwsSpotInstanceRequestRead(d *schema.ResourceData, meta interface{} request := resp.SpotInstanceRequests[0] - // if the request is cancelled, then it is gone - if *request.State == "cancelled" { + // if the request is cancelled or closed, then it is gone + if *request.State == "cancelled" || *request.State == "closed" { d.SetId("") return nil } diff --git a/aws/resource_aws_spot_instance_request_test.go b/aws/resource_aws_spot_instance_request_test.go index 4621565bf49..5f969fd7633 100644 --- a/aws/resource_aws_spot_instance_request_test.go +++ b/aws/resource_aws_spot_instance_request_test.go @@ -211,8 +211,9 @@ func testAccCheckAWSSpotInstanceRequestDestroy(s *terraform.State) error { return nil } - if *s.State == "canceled" { + if *s.State == "canceled" || *s.State == "closed" { // Requests stick around for a while, so we make sure it's cancelled + // or closed. return nil }