From e30971cacc51d10c70b6c44a07acc860f4956de9 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Tue, 12 Feb 2019 10:17:50 -0600 Subject: [PATCH] Fix crash on unsuccessful flow log creation --- aws/resource_aws_flow_log.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aws/resource_aws_flow_log.go b/aws/resource_aws_flow_log.go index ae0dd9dac07..fc3700300a2 100644 --- a/aws/resource_aws_flow_log.go +++ b/aws/resource_aws_flow_log.go @@ -142,6 +142,10 @@ func resourceAwsLogFlowCreate(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error creating Flow Log for (%s), error: %s", resourceId, err) } + if len(resp.Unsuccessful) > 0 { + return fmt.Errorf("Error creating Flow Log for (%s), error: %s", resourceId, *resp.Unsuccessful[0].Error.Message) + } + if len(resp.FlowLogIds) > 1 { return fmt.Errorf("Error: multiple Flow Logs created for (%s)", resourceId) }