Skip to content

Commit

Permalink
Fix crash on unsuccessful flow log creation
Browse files Browse the repository at this point in the history
  • Loading branch information
phy1729 committed Feb 12, 2019
1 parent ebd8479 commit e30971c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions aws/resource_aws_flow_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit e30971c

Please sign in to comment.