Skip to content

Commit

Permalink
Merge pull request #2964 from comtravo/fix/lambda-update-function-con…
Browse files Browse the repository at this point in the history
…figuration

resource/aws_lambda_function: Make rate limit errors retryable
  • Loading branch information
bflad authored Jan 17, 2018
2 parents 85b7eeb + 07c6c65 commit 287c8de
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion aws/resource_aws_lambda_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,10 +639,24 @@ func resourceAwsLambdaFunctionUpdate(d *schema.ResourceData, meta interface{}) e

if configUpdate {
log.Printf("[DEBUG] Send Update Lambda Function Configuration request: %#v", configReq)
_, err := conn.UpdateFunctionConfiguration(configReq)

err := resource.Retry(10*time.Minute, func() *resource.RetryError {
_, err := conn.UpdateFunctionConfiguration(configReq)
if err != nil {
log.Printf("[DEBUG] Received error modifying Lambda Function Configuration %s: %s", d.Id(), err)

if isAWSErr(err, "InvalidParameterValueException", "Your request has been throttled by EC2, please make sure you have enough API rate limit.") {
log.Printf("[DEBUG] Received %s, retrying UpdateFunctionConfiguration", err)
return resource.RetryableError(err)
}
return resource.NonRetryableError(err)
}
return nil
})
if err != nil {
return fmt.Errorf("Error modifying Lambda Function Configuration %s: %s", d.Id(), err)
}

d.SetPartial("description")
d.SetPartial("handler")
d.SetPartial("memory_size")
Expand Down

0 comments on commit 287c8de

Please sign in to comment.