diff --git a/aws/resource_aws_codepipeline.go b/aws/resource_aws_codepipeline.go index 501eb5709e4..854e2b7661f 100644 --- a/aws/resource_aws_codepipeline.go +++ b/aws/resource_aws_codepipeline.go @@ -5,7 +5,6 @@ import ( "fmt" "log" "os" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/codepipeline" @@ -13,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsCodePipeline() *schema.Resource { @@ -190,14 +190,19 @@ func resourceAwsCodePipelineCreate(d *schema.ResourceData, meta interface{}) err } var resp *codepipeline.CreatePipelineOutput - err = resource.Retry(2*time.Minute, func() *resource.RetryError { + err = resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error resp, err = conn.CreatePipeline(params) - if err != nil { + if isAWSErr(err, codepipeline.ErrCodeInvalidStructureException, "not authorized") { return resource.RetryableError(err) } + + if err != nil { + return resource.NonRetryableError(err) + } + return nil }) if isResourceTimeoutError(err) {