provider/aws: Fix all pointer RetryError returns

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 #5537
This commit is contained in:
Paul Hinze 2016-03-09 14:56:04 -06:00
parent 8d051ef268
commit de656942ae
6 changed files with 13 additions and 13 deletions

View File

@ -81,7 +81,7 @@ func resourceAwsCloudWatchEventRuleCreate(d *schema.ResourceData, meta interface
return err return err
} }
} }
return &resource.RetryError{ return resource.RetryError{
Err: err, Err: err,
} }
} }
@ -168,7 +168,7 @@ func resourceAwsCloudWatchEventRuleUpdate(d *schema.ResourceData, meta interface
return err return err
} }
} }
return &resource.RetryError{ return resource.RetryError{
Err: err, Err: err,
} }
} }

View File

@ -163,7 +163,7 @@ func resourceAwsCodeDeployDeploymentGroupCreate(d *schema.ResourceData, meta int
if err != nil { if err != nil {
codedeployErr, ok := err.(awserr.Error) codedeployErr, ok := err.(awserr.Error)
if !ok { if !ok {
return &resource.RetryError{Err: err} return resource.RetryError{Err: err}
} }
if codedeployErr.Code() == "InvalidRoleException" { if codedeployErr.Code() == "InvalidRoleException" {
log.Printf("[DEBUG] Trying to create deployment group again: %q", log.Printf("[DEBUG] Trying to create deployment group again: %q",
@ -171,7 +171,7 @@ func resourceAwsCodeDeployDeploymentGroupCreate(d *schema.ResourceData, meta int
return err return err
} }
return &resource.RetryError{Err: err} return resource.RetryError{Err: err}
} }
return nil return nil
}) })

View File

@ -137,7 +137,7 @@ func resourceAwsEcsServiceCreate(d *schema.ResourceData, meta interface{}) error
if err != nil { if err != nil {
ec2err, ok := err.(awserr.Error) ec2err, ok := err.(awserr.Error)
if !ok { if !ok {
return &resource.RetryError{Err: err} return resource.RetryError{Err: err}
} }
if ec2err.Code() == "InvalidParameterException" { if ec2err.Code() == "InvalidParameterException" {
log.Printf("[DEBUG] Trying to create ECS service again: %q", log.Printf("[DEBUG] Trying to create ECS service again: %q",
@ -145,7 +145,7 @@ func resourceAwsEcsServiceCreate(d *schema.ResourceData, meta interface{}) error
return err return err
} }
return &resource.RetryError{Err: err} return resource.RetryError{Err: err}
} }
return nil return nil
@ -322,7 +322,7 @@ func resourceAwsEcsServiceDelete(d *schema.ResourceData, meta interface{}) error
ec2err, ok := err.(awserr.Error) ec2err, ok := err.(awserr.Error)
if !ok { if !ok {
return &resource.RetryError{Err: err} return resource.RetryError{Err: err}
} }
if ec2err.Code() == "InvalidParameterException" { if ec2err.Code() == "InvalidParameterException" {
// Prevent "The service cannot be stopped while deployments are active." // Prevent "The service cannot be stopped while deployments are active."
@ -331,7 +331,7 @@ func resourceAwsEcsServiceDelete(d *schema.ResourceData, meta interface{}) error
return err return err
} }
return &resource.RetryError{Err: err} return resource.RetryError{Err: err}
}) })
if err != nil { if err != nil {

View File

@ -223,7 +223,7 @@ func attachPolicyToRoles(conn *iam.IAM, roles []*string, arn string) error {
attachedPolicies, err := conn.ListRolePolicies(&input) attachedPolicies, err := conn.ListRolePolicies(&input)
if err != nil { if err != nil {
return &resource.RetryError{Err: err} return resource.RetryError{Err: err}
} }
if len(attachedPolicies.PolicyNames) > 0 { if len(attachedPolicies.PolicyNames) > 0 {
@ -236,7 +236,7 @@ func attachPolicyToRoles(conn *iam.IAM, roles []*string, arn string) error {
} }
if !foundPolicy { 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)}
} }
} }

View File

@ -436,7 +436,7 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface
return err return err
} }
} }
return &resource.RetryError{ return resource.RetryError{
Err: err, Err: err,
} }
} }

View File

@ -316,7 +316,7 @@ func resourceAwsVpcDelete(d *schema.ResourceData, meta interface{}) error {
ec2err, ok := err.(awserr.Error) ec2err, ok := err.(awserr.Error)
if !ok { if !ok {
return &resource.RetryError{Err: err} return resource.RetryError{Err: err}
} }
switch ec2err.Code() { switch ec2err.Code() {
@ -326,7 +326,7 @@ func resourceAwsVpcDelete(d *schema.ResourceData, meta interface{}) error {
return err return err
} }
return &resource.RetryError{ return resource.RetryError{
Err: fmt.Errorf("Error deleting VPC: %s", err), Err: fmt.Errorf("Error deleting VPC: %s", err),
} }
}) })