From fcb31e9d80ea4441f75d19f6d242d5ea07f30d24 Mon Sep 17 00:00:00 2001 From: Ryn Daniels Date: Mon, 3 Jun 2019 18:47:12 +0200 Subject: [PATCH] Add a nil check for reading spot options --- aws/resource_aws_launch_template.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_launch_template.go b/aws/resource_aws_launch_template.go index a052486a422..be58da52a4f 100644 --- a/aws/resource_aws_launch_template.go +++ b/aws/resource_aws_launch_template.go @@ -1421,7 +1421,10 @@ func readInstanceMarketOptionsFromConfig(imo map[string]interface{}) (*ec2.Launc if v, ok := imo["spot_options"]; ok { vL := v.([]interface{}) for _, v := range vL { - so := v.(map[string]interface{}) + so, ok := v.(map[string]interface{}) + if !ok { + continue + } if v, ok := so["block_duration_minutes"].(int); ok && v != 0 { spotOptions.BlockDurationMinutes = aws.Int64(int64(v))