Use strings.HasPrefix instead of regexp for lambda_permission

This commit is contained in:
Jake Champlin 2017-01-23 12:34:56 -05:00
parent 763cfcdb1f
commit 8580f58063
No known key found for this signature in database
GPG Key ID: DC31F41958EF4AC2
1 changed files with 1 additions and 1 deletions

View File

@ -216,7 +216,7 @@ func resourceAwsLambdaPermissionRead(d *schema.ResourceData, meta interface{}) e
}
// Save Lambda function name in the same format
if regexp.MustCompile(`^arn:[\w-]+:lambda:`).MatchString(d.Get("function_name").(string)) {
if strings.HasPrefix(d.Get("function_name").(string), "arn:"+meta.(*AWSClient).partition+":lambda:") {
// Strip qualifier off
trimmedArn := strings.TrimSuffix(statement.Resource, ":"+qualifier)
d.Set("function_name", trimmedArn)