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

Library usage and Default values #3645

Open
kddejong opened this issue Aug 30, 2024 · 0 comments
Open

Library usage and Default values #3645

kddejong opened this issue Aug 30, 2024 · 0 comments

Comments

@kddejong
Copy link
Contributor

kddejong commented Aug 30, 2024

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<String>
    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 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.

aws-cloudformation/cfn-lint#3640

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

No branches or pull requests

1 participant