-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(aws-lambda): Cannot specify organization subset in Lambda permission #28499
Comments
I am not sure if it's possible to do that as AWS::Lambda::Permission only allows to specify PrincipalOrgId. This could be a blocker from cloudformation. Also, if we look at the CLI document, it does not allow you to specify org path for scoped control to OU. I doubt it's possible from API's perspective. I will create an internal ticket for clarification. |
ticket V1176480060 |
Thanks a lot for the fast answer! Indeed, I took a look to the CloudFormation documentation and I could not see any reference to that "subset of the organization". Then I thought CDK was replacing in those cases |
@nebur395 Looks like Lambda permission doesn't support that at this moment. We have created an internal ticket for the feature request to the lambda team. Before that, I am afraid we can't do anything with CDK. |
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
@pahud thanks a lot for the feedback :) |
|
Describe the bug
I want to add a "Permission" to a lambda to be invoked by an entire OrganizationalUnit but not the entire Organization to be more granular.
Based in the documentation, I understand it should be possible by specifying the principal (...an AWS organization principal to grant permissions to an entire organization.) and then the organizacionId (...Use this ONLY if you need to grant permissions to a subset of the organization...). However, when I specify a PrincipalOrg+OrganizationId, it throws a validation constraint error.
For the organizationId I've tried multiple formats:
organizationId: 'o-123456789/r-1234/ou-1234-123456789'
,organizationId: 'r-1234/ou-1234-123456789'
,organizationId: ou-1234-123456789'
. But all of them throw the same error.If I don't specify organizationId:
Then it works and does not generate any error. However, as expected, it attaches a policy with PrincipalOrgId and it grants any principal from the entire organization access to the lambda (which is the thing I would like to avoid). This is the generated permission from the previous code in the AWS console:
So either I don't fully understand the documentation (which could be the case) or there is a bug in this feature. If it is the former, then I don't understand why I would need the organizationId if I cannot specify an OU as a subset of the organization and then what is that property for. If it is the latter, I've tried to check the source code of that function and it seems it attaches the condition
aws:PrincipalOrgID
always, no matter if you just specify the principal or the principal+organizationId. Maybe for the principal+organizationId it would be feasible to useaws:PrincipalOrgPaths
.Thanks a lot!!
Expected Behavior
Given this function:
When specifying just
principal
it grants access to that lambda to the entire organization:When specifying both
principal
andorganizationId
it grants access to that lambda to a subset (OU) inside the organization:Current Behavior
Given this function:
I get the following error:
Properties validation failed for resource LambdaPermission with message: #/PrincipalOrgID: failed validation constraint for keyword [pattern]
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.109.0
Framework Version
No response
Node.js Version
18.18.2
OS
macOS 13.6.2
Language
TypeScript
Language Version
5.2.2
Other information
No response
The text was updated successfully, but these errors were encountered: