Skip to content

Commit

Permalink
Merge pull request #6770 from Puneeth-n/fix/lambda-permission-deletio…
Browse files Browse the repository at this point in the history
…n-failure

Do not throw error when lambda permission is deleted after function
  • Loading branch information
bflad authored Dec 11, 2018
2 parents 89f03ff + 6ca1d6c commit a398691
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions aws/resource_aws_lambda_permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,13 @@ func resourceAwsLambdaPermissionDelete(d *schema.ResourceData, meta interface{})
log.Printf("[DEBUG] Removing Lambda permission: %s", input)
_, err := conn.RemovePermission(&input)
if err != nil {
// Missing whole policy or Lambda function (API error)
if awsErr, ok := err.(awserr.Error); ok {
if awsErr.Code() == "ResourceNotFoundException" {
log.Printf("[WARN] No Lambda Permission Policy found: %v", input)
return nil
}
}
return err
}

Expand Down

0 comments on commit a398691

Please sign in to comment.