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

Sentinel forwarder fails to apply if not using most recent layer ARN #203

Open
patheard opened this issue Jan 23, 2023 · 1 comment
Open

Comments

@patheard
Copy link
Member

Summary

The sentinel_forwarder module fails to Terraform apply if the layer_arn being used is not the most recently published layer version:

╷
│ Error: error creating Lambda Function (1): AccessDeniedException: 
│ 	status code: 403, request id: 4be17092-313c-469a-b905-45f6cbec8546
│ 
│   with module.sentinel_forwarder.aws_lambda_function.sentinel_forwarder,
│   on .terraform/modules/sentinel_forwarder/sentinel_forwarder/main.tf line 34, in resource "aws_lambda_function" "sentinel_forwarder":
│   34: resource "aws_lambda_function" "sentinel_forwarder" {
│ 
│
│ "User is not authorized to perform: lambda:GetLayerVersion on 
│ resource: arn:aws:lambda:ca-central-1:283582579564:layer:aws-sentinel-connector-layer:20 
│ because no resource-based policy allows the lambda:GetLayerVersion action"

Although the layer has a permission policy created for it on publish, it appears that this permission is being removed when a new layer version is published.

aws lambda get-layer-version-policy \
  --layer-name aws-sentinel-connector-layer \
  --version-number 37

# policy returned successfully

aws lambda get-layer-version-policy \
  --layer-name aws-sentinel-connector-layer \
  --version-number 36

# Following error returned for any layer version that is not the latest
An error occurred (ResourceNotFoundException) when calling the GetLayerVersionPolicy operation: Layer version arn:aws:lambda:ca-central-1:283582579564:layer:aws-sentinel-connector-layer:36 does not have any resource policy.

Related

@patheard
Copy link
Member Author

This implies it's possible to re-add the lambda layer's resource based policy to previous versions, but it's not clear what's causing the removal of the permission in the first place:
https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html#permissions-resource-xaccountlayer

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

No branches or pull requests

1 participant