From 2fedaa9a4bc41268786f2cc4bd68be2d48acd794 Mon Sep 17 00:00:00 2001 From: Clint Shryock Date: Tue, 7 Jul 2015 09:48:04 -0600 Subject: [PATCH] provider/aws: Fix issue where spot instance requests would crash Requests that are pending do not have an InstanceID --- builtin/providers/aws/resource_aws_spot_instance_request.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/builtin/providers/aws/resource_aws_spot_instance_request.go b/builtin/providers/aws/resource_aws_spot_instance_request.go index d37ef8a34..464a3de0c 100644 --- a/builtin/providers/aws/resource_aws_spot_instance_request.go +++ b/builtin/providers/aws/resource_aws_spot_instance_request.go @@ -166,7 +166,10 @@ func resourceAwsSpotInstanceRequestRead(d *schema.ResourceData, meta interface{} } d.Set("spot_bid_status", *request.Status.Code) - d.Set("spot_instance_id", *request.InstanceID) + // Instance ID is not set if the request is still pending + if request.InstanceID != nil { + d.Set("spot_instance_id", *request.InstanceID) + } d.Set("spot_request_state", *request.State) d.Set("tags", tagsToMap(request.Tags))