Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layer not assignable to lambda when using Terraform #156

Closed
viorel-ognean opened this issue Oct 22, 2024 · 6 comments
Closed

Layer not assignable to lambda when using Terraform #156

viorel-ognean opened this issue Oct 22, 2024 · 6 comments

Comments

@viorel-ognean
Copy link

I am using Terraform to create my Lambda in eu-west-1.

If I try to use the vault-lambda-extension version 20 , then I get the following error:

Error: creating Lambda Function (function-name): operation error Lambda: CreateFunction, https response error StatusCode: 403, RequestID: redacted, api error AccessDeniedException: User: redacted is not authorized to perform: lambda:GetLayerVersion on resource: arn:aws:lambda:eu-west-1:634166935893:layer:vault-lambda-extension:20 because no resource-based policy allows the lambda:GetLayerVersion action with module.function_name.aws_lambda_function.generic, on .terraform/modules/function_name/main.tf line 177, in resource "aws_lambda_function" "generic": 177: resource "aws_lambda_function" "generic" {

Everything is working fine with vault-lambda-extension version 19

@fairclothjm
Copy link
Contributor

Hello @viorel-ognean @tmatilai I am sorry you are having trouble. Can you confirm that this occurs in all regions for version 20 or is it only in eu-west-1? I don't see this happening in us-east-1 for example. Any more info would be appreciated! Thanks!

@tmatilai
Copy link

tmatilai commented Oct 28, 2024

Hi @fairclothjm ,

This doesn't seem to be region specific. Version 20 fails for me also in the us-east-1. I haven't managed any Lambda layers, but feels like some resource policy issue.

And the issue is not Terraform specific. This works:

aws lambda --region us-east-1 get-layer-version --layer-name arn:aws:lambda:us-east-1:634166935893:layer:vault-lambda-extension --version-number 19

This fails with the access error:

aws lambda --region us-east-1 get-layer-version --layer-name arn:aws:lambda:us-east-1:634166935893:layer:vault-lambda-extension --version-number 20

Maybe you were testing with credentials in that 634166935893 account hosting the layer?

@fairclothjm
Copy link
Contributor

fairclothjm commented Oct 28, 2024

@viorel-ognean @tmatilai Can you please try again? This should be resolved now.

@juancarlosjr97
Copy link

juancarlosjr97 commented Oct 29, 2024

@fairclothjm I was getting the same error and now it is working. Thank you :)

@viorel-ognean
Copy link
Author

this issue is now fixed, thanks for the help.

@tmatilai
Copy link

Confirmed, works here, too. Thanks! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants