Skip to content

Commit

Permalink
Merge pull request #9682 from terraform-providers/rfd-retry-code
Browse files Browse the repository at this point in the history
Final retries after timeouts in various code-related resources
  • Loading branch information
ryndaniels authored Aug 9, 2019
2 parents 0fae745 + 19f7934 commit 6218a23
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
8 changes: 6 additions & 2 deletions aws/resource_aws_codebuild_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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",
Expand Down
10 changes: 8 additions & 2 deletions aws/resource_aws_codedeploy_deployment_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions aws/resource_aws_codepipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 6218a23

Please sign in to comment.