You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(lambda): allow ArnPrincipal in grantInvoke (#3501)
Fixes#3264
I'm trying to allow a lambda function in another account to be able to invoke my CDK generated lambda function. This works through the CLI like so:
aws lambda add-permission --function-name=myFunction --statement-id=ABoldStatement --action=lambda:InvokeFunction --principal=arn:aws:iam::{account_id}:role/a_lambda_execution_role
But CDK doesn't seem to allow me to add an ArnPrincipal doing something like this:
myFunction.grantInvoke(new iam.ArnPrincipal(props.myARN))
With the error:
Invalid principal type for Lambda permission statement: ArnPrincipal. Supported: AccountPrincipal, ServicePrincipal
This PR allows ArnPrincipal to be passed to lambda.grantInvoke.
There might be some additional validation required on the exact ARN as I believe only some ARNs are supported by lambda add-permission
0 commit comments