Skip to content

Commit

Permalink
Merge pull request #9039 from terraform-providers/rfd-retry-appautosc…
Browse files Browse the repository at this point in the history
…aling

Retries for appautoscaling
  • Loading branch information
ryndaniels authored Jun 20, 2019
2 parents dd11bdc + e9c499f commit a57a5f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions aws/resource_aws_appautoscaling_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ func resourceAwsAppautoscalingPolicyCreate(d *schema.ResourceData, meta interfac
}
return nil
})
if isResourceTimeoutError(err) {
resp, err = conn.PutScalingPolicy(&params)
}
if err != nil {
return fmt.Errorf("Failed to create scaling policy: %s", err)
}
Expand All @@ -302,6 +305,9 @@ func resourceAwsAppautoscalingPolicyRead(d *schema.ResourceData, meta interface{
}
return nil
})
if isResourceTimeoutError(err) {
p, err = getAwsAppautoscalingPolicy(d, meta)
}
if err != nil {
return fmt.Errorf("Failed to read scaling policy: %s", err)
}
Expand Down Expand Up @@ -353,6 +359,9 @@ func resourceAwsAppautoscalingPolicyUpdate(d *schema.ResourceData, meta interfac
}
return nil
})
if isResourceTimeoutError(err) {
_, err = conn.PutScalingPolicy(&params)
}
if err != nil {
return fmt.Errorf("Failed to update scaling policy: %s", err)
}
Expand Down
5 changes: 4 additions & 1 deletion aws/resource_aws_appautoscaling_scheduled_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,12 @@ func resourceAwsAppautoscalingScheduledActionPut(d *schema.ResourceData, meta in
}
return nil
})
if isResourceTimeoutError(err) {
_, err = conn.PutScheduledAction(input)
}

if err != nil {
return err
return fmt.Errorf("Error putting scheduled action: %s", err)
}

d.SetId(d.Get("name").(string) + "-" + d.Get("service_namespace").(string) + "-" + d.Get("resource_id").(string))
Expand Down

0 comments on commit a57a5f9

Please sign in to comment.