provider/aws: handle aws_lambda_function missing s3 key error (#10960)

* ensure NoSuchKey is not a retryable error

* Simplify err handling + lower log msg severity
This commit is contained in:
Jonathan Camp 2017-04-01 16:39:46 +02:00 committed by Radek Simko
parent 6667a85cd9
commit b8f6e2a70a
1 changed files with 6 additions and 7 deletions

View File

@ -297,14 +297,13 @@ func resourceAwsLambdaFunctionCreate(d *schema.ResourceData, meta interface{}) e
err := resource.Retry(10*time.Minute, func() *resource.RetryError {
_, err := conn.CreateFunction(params)
if err != nil {
log.Printf("[ERROR] Received %q, retrying CreateFunction", err)
if awserr, ok := err.(awserr.Error); ok {
if awserr.Code() == "InvalidParameterValueException" {
log.Printf("[DEBUG] InvalidParameterValueException creating Lambda Function: %s", awserr)
return resource.RetryableError(awserr)
}
}
log.Printf("[DEBUG] Error creating Lambda Function: %s", err)
if isAWSErr(err, "InvalidParameterValueException", "The role defined for the function cannot be assumed by Lambda") {
log.Printf("[DEBUG] Received %s, retrying CreateFunction", err)
return resource.RetryableError(err)
}
return resource.NonRetryableError(err)
}
return nil