aws / aws/serverless-application-model
Library usage and Default values
- Dominant language
- Python
- Stars
- 9.6k
- Forks
- 2.5k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 7
Description
When using SAM translator as a library on the following template
```
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: mvp
Parameters:
AuthorizerFunctionArn:
Type: AWS::SSM::Parameter::Value
Default: authorizer.arn
Description: Gatekeeper Authorizer Function Arn
Resources:
RestApi:
Type: AWS::Serverless::Api
Properties:
Name: my-api
StageName: v1
EndpointConfiguration:
Type: REGIONAL
BinaryMediaTypes:
- "*~1*"
Auth:
Authorizers:
GatekeeperAuth:
FunctionArn: !Ref AuthorizerFunctionArn
DefaultAuthorizer: GatekeeperAuth
```
will provide a template with
```
"RestApiGatekeeperAuthAuthorizerPermission": {
"Properties": {
"Action": "lambda:InvokeFunction",
"FunctionName": "authorizer.arn",
"Principal": "apigateway.amazonaws.com",
```
This is because [this code](https://github.com/aws/serverless-application-model/blob/15dc964a9e47e084b809985bbe898f7441e8a67b/samtranslator/sdk/parameter.py#L62-L64) will read the Default value. Not sure fully how this works server side but the SSM parameter substitution must substitute its value into the Default space? Either way it may be nice to not have this value substituted when using SAM translator as a library if the value is a SSM parameter. Or a feature flag that would prevent using Default values at all as I would prefer the REF to be based to any newly created resources.
https://github.com/aws-cloudformation/cfn-lint/issues/3640
Contributor guide
Assessment
This issue has not been assessed yet.