From 6bc2e010627aa6c767d99b9a5d297f5ff701d64a Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Mon, 19 Jun 2017 10:17:43 +0100 Subject: [PATCH] resource/codebuild: Increase timeout for creation retry (IAM) --- aws/resource_aws_codebuild_project.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/aws/resource_aws_codebuild_project.go b/aws/resource_aws_codebuild_project.go index bbd3523a300..92a960221ba 100644 --- a/aws/resource_aws_codebuild_project.go +++ b/aws/resource_aws_codebuild_project.go @@ -212,16 +212,21 @@ func resourceAwsCodeBuildProjectCreate(d *schema.ResourceData, meta interface{}) } var resp *codebuild.CreateProjectOutput - err := resource.Retry(2*time.Minute, func() *resource.RetryError { + err := resource.Retry(5*time.Minute, func() *resource.RetryError { var err error resp, err = conn.CreateProject(params) - if err != nil { - return resource.RetryableError(err) + // Work around eventual consistency of IAM + if isAWSErr(err, "InvalidInputException", "CodeBuild is not authorized to perform") { + return resource.RetryableError(err) + } + + return resource.NonRetryableError(err) } - return resource.NonRetryableError(err) + return nil + }) if err != nil {