provider/aws: Fix issue where spot instance requests would crash

Requests that are pending do not have an InstanceID
This commit is contained in:
Clint Shryock 2015-07-07 09:48:04 -06:00
parent b4c1c223ff
commit 2fedaa9a4b
1 changed files with 4 additions and 1 deletions

View File

@ -166,7 +166,10 @@ func resourceAwsSpotInstanceRequestRead(d *schema.ResourceData, meta interface{}
} }
d.Set("spot_bid_status", *request.Status.Code) 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("spot_request_state", *request.State)
d.Set("tags", tagsToMap(request.Tags)) d.Set("tags", tagsToMap(request.Tags))