Skip to content

Commit

Permalink
provider/aws: Fix all pointer RetryError returns
Browse files Browse the repository at this point in the history
All of these RetryErrors were meant to fail right away, but instead
caused retry looping because the typecheck in the implementation of
`resource.Retry()` only catches the value type, and not the pointer
type.

Refs #5463
  • Loading branch information
phinze committed Mar 9, 2016
1 parent 8d051ef commit e637848
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions builtin/providers/aws/resource_aws_cloudwatch_event_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func resourceAwsCloudWatchEventRuleCreate(d *schema.ResourceData, meta interface
return err
}
}
return &resource.RetryError{
return resource.RetryError{
Err: err,
}
}
Expand Down Expand Up @@ -168,7 +168,7 @@ func resourceAwsCloudWatchEventRuleUpdate(d *schema.ResourceData, meta interface
return err
}
}
return &resource.RetryError{
return resource.RetryError{
Err: err,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ func resourceAwsCodeDeployDeploymentGroupCreate(d *schema.ResourceData, meta int
if err != nil {
codedeployErr, ok := err.(awserr.Error)
if !ok {
return &resource.RetryError{Err: err}
return resource.RetryError{Err: err}
}
if codedeployErr.Code() == "InvalidRoleException" {
log.Printf("[DEBUG] Trying to create deployment group again: %q",
codedeployErr.Message())
return err
}

return &resource.RetryError{Err: err}
return resource.RetryError{Err: err}
}
return nil
})
Expand Down
8 changes: 4 additions & 4 deletions builtin/providers/aws/resource_aws_ecs_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ func resourceAwsEcsServiceCreate(d *schema.ResourceData, meta interface{}) error
if err != nil {
ec2err, ok := err.(awserr.Error)
if !ok {
return &resource.RetryError{Err: err}
return resource.RetryError{Err: err}
}
if ec2err.Code() == "InvalidParameterException" {
log.Printf("[DEBUG] Trying to create ECS service again: %q",
ec2err.Message())
return err
}

return &resource.RetryError{Err: err}
return resource.RetryError{Err: err}
}

return nil
Expand Down Expand Up @@ -322,7 +322,7 @@ func resourceAwsEcsServiceDelete(d *schema.ResourceData, meta interface{}) error

ec2err, ok := err.(awserr.Error)
if !ok {
return &resource.RetryError{Err: err}
return resource.RetryError{Err: err}
}
if ec2err.Code() == "InvalidParameterException" {
// Prevent "The service cannot be stopped while deployments are active."
Expand All @@ -331,7 +331,7 @@ func resourceAwsEcsServiceDelete(d *schema.ResourceData, meta interface{}) error
return err
}

return &resource.RetryError{Err: err}
return resource.RetryError{Err: err}

})
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions builtin/providers/aws/resource_aws_iam_policy_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func attachPolicyToRoles(conn *iam.IAM, roles []*string, arn string) error {

attachedPolicies, err := conn.ListRolePolicies(&input)
if err != nil {
return &resource.RetryError{Err: err}
return resource.RetryError{Err: err}
}

if len(attachedPolicies.PolicyNames) > 0 {
Expand All @@ -236,7 +236,7 @@ func attachPolicyToRoles(conn *iam.IAM, roles []*string, arn string) error {
}

if !foundPolicy {
return &resource.RetryError{Err: fmt.Errorf("Policy (%q) not yet found", arn)}
return resource.RetryError{Err: fmt.Errorf("Policy (%q) not yet found", arn)}
}
}

Expand Down
2 changes: 1 addition & 1 deletion builtin/providers/aws/resource_aws_launch_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface
return err
}
}
return &resource.RetryError{
return resource.RetryError{
Err: err,
}
}
Expand Down
4 changes: 2 additions & 2 deletions builtin/providers/aws/resource_aws_vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func resourceAwsVpcDelete(d *schema.ResourceData, meta interface{}) error {

ec2err, ok := err.(awserr.Error)
if !ok {
return &resource.RetryError{Err: err}
return resource.RetryError{Err: err}
}

switch ec2err.Code() {
Expand All @@ -326,7 +326,7 @@ func resourceAwsVpcDelete(d *schema.ResourceData, meta interface{}) error {
return err
}

return &resource.RetryError{
return resource.RetryError{
Err: fmt.Errorf("Error deleting VPC: %s", err),
}
})
Expand Down

0 comments on commit e637848

Please sign in to comment.