From 19f79344c592c0db3851f051bbd7b2526bb02b40 Mon Sep 17 00:00:00 2001 From: Ryn Daniels Date: Thu, 8 Aug 2019 15:57:41 +0200 Subject: [PATCH] Final retries after timeouts in various code-related resources --- aws/resource_aws_codebuild_project.go | 8 ++++++-- aws/resource_aws_codedeploy_deployment_group.go | 10 ++++++++-- aws/resource_aws_codepipeline.go | 3 +++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/aws/resource_aws_codebuild_project.go b/aws/resource_aws_codebuild_project.go index f8b1862f0af..217e99f7803 100644 --- a/aws/resource_aws_codebuild_project.go +++ b/aws/resource_aws_codebuild_project.go @@ -649,9 +649,11 @@ func resourceAwsCodeBuildProjectCreate(d *schema.ResourceData, meta interface{}) } return nil - }) + if isResourceTimeoutError(err) { + resp, err = conn.CreateProject(params) + } if err != nil { return fmt.Errorf("Error creating CodeBuild project: %s", err) } @@ -1157,9 +1159,11 @@ func resourceAwsCodeBuildProjectUpdate(d *schema.ResourceData, meta interface{}) } return nil - }) + if isResourceTimeoutError(err) { + _, err = conn.UpdateProject(params) + } if err != nil { return fmt.Errorf( "[ERROR] Error updating CodeBuild project (%s): %s", diff --git a/aws/resource_aws_codedeploy_deployment_group.go b/aws/resource_aws_codedeploy_deployment_group.go index b4af8e082d5..d2f939d0c7c 100644 --- a/aws/resource_aws_codedeploy_deployment_group.go +++ b/aws/resource_aws_codedeploy_deployment_group.go @@ -555,8 +555,11 @@ func resourceAwsCodeDeployDeploymentGroupCreate(d *schema.ResourceData, meta int return handleCreateError(err) }) + if isResourceTimeoutError(err) { + resp, err = conn.CreateDeploymentGroup(&input) + } if err != nil { - return err + return fmt.Errorf("Error creating CodeDeploy deployment group: %s", err) } d.SetId(*resp.DeploymentGroupId) @@ -732,8 +735,11 @@ func resourceAwsCodeDeployDeploymentGroupUpdate(d *schema.ResourceData, meta int return handleUpdateError(err) }) + if isResourceTimeoutError(err) { + _, err = conn.UpdateDeploymentGroup(&input) + } if err != nil { - return err + return fmt.Errorf("Error updating CodeDeploy deployment group: %s", err) } return resourceAwsCodeDeployDeploymentGroupRead(d, meta) diff --git a/aws/resource_aws_codepipeline.go b/aws/resource_aws_codepipeline.go index 444e2dc7dd9..d31a514bb08 100644 --- a/aws/resource_aws_codepipeline.go +++ b/aws/resource_aws_codepipeline.go @@ -185,6 +185,9 @@ func resourceAwsCodePipelineCreate(d *schema.ResourceData, meta interface{}) err return resource.NonRetryableError(err) }) + if isResourceTimeoutError(err) { + resp, err = conn.CreatePipeline(params) + } if err != nil { return fmt.Errorf("Error creating CodePipeline: %s", err) }