Closed whimzyLive closed 1 year ago
This is still an outstanding issue. I'm interested in getting this resolved -- or possibly, require the leading slash to be consistent with AWS CLI syntax.
I have same problem. Any updates?
+1
How are others working around this?
I have an SSM path coming from a template parameter with a type of AWS::SSM::Parameter::Name, which validates that the input is a valid SSM parameter which exists at deploy-time. Due to SSM naming rules, this means that the input must begin with a "/". So, we run into the same problem.
Is there an intrinsic CloudFormation function that can check for / grab a substring? If not, would fixing this (at the SAM level) require a separate policy template altogether?
More broadly, there's plenty of services having ARNs that follow the pattern of service:${region}:${account}:resource/${resource_name}
. But I'm not aware of any (besides SSM) that will return you a leading / as part of the name, then refuse to accept resource/${resource_name}
in the ARN. But that's not something SAM can fix.
Closing this, it will be released over the coming weeks
Description: When using
SSMParameterReadPolicy
policy template withParameterName
!Ref..ed to SSM resourceSSMParameterReadPolicy
will generate incorrect arn mapping. For example:Here I am creating SSM resource and lambda function that will use this SSM parameter, as well as I am using SAM policy templates to allow
MyFunction
to allow read access toMyCredParameter
.This will deploy successfully, However, when Lambda tries to get value from SSM params with name process.env.MY_CRED, it will fail.
After some debugging I found out that, My lambda function role had permission to call
arn:aws:ssm:my-region:000000000:parameter//prefix/environment/applications/mycred
SSM parameter instead ofarn:aws:ssm:my-region:000000000:parameter/prefix/environment/applications/mycred
. Notice that extra '/' after parameter in first arn.Observed result: This was because SAM policy templates uses
ParameterName
as is to create arn without doing any sort of validation.Expected result: It would be nice to have this
ParameterName
validated and add or remove/
based on validation. Or acceptParameterName
with/
and do not add/
while creating policy, since all SSM parameter name must start with/
to be a valid SSM Name.