Skip to content

Commit

Permalink
Merge pull request #3651 from terraform-providers/t-aws_cloud9_enviro…
Browse files Browse the repository at this point in the history
…nment_ec2-user-notfoundexception

resource/aws_cloud9_environment_ec2: Retry creation for IAM eventual consistency
  • Loading branch information
bflad authored Mar 7, 2018
2 parents 21eed8e + 3d70935 commit 42021c5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion aws/resource_aws_cloud9_environment_ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,20 @@ func resourceAwsCloud9EnvironmentEc2Create(d *schema.ResourceData, meta interfac
params.SubnetId = aws.String(v.(string))
}

out, err := conn.CreateEnvironmentEC2(params)
var out *cloud9.CreateEnvironmentEC2Output
err := resource.Retry(1*time.Minute, func() *resource.RetryError {
var err error
out, err = conn.CreateEnvironmentEC2(params)
if err != nil {
// NotFoundException: User arn:aws:iam::*******:user/****** does not exist.
if isAWSErr(err, cloud9.ErrCodeNotFoundException, "User") {
return resource.RetryableError(err)
}
return resource.NonRetryableError(err)
}
return nil
})

if err != nil {
return err
}
Expand Down

0 comments on commit 42021c5

Please sign in to comment.