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

Conditional statments not works in AWS::Serverless::Function Events #1724

Closed
pandithdurai opened this issue Sep 24, 2020 · 2 comments
Closed
Assignees
Labels
area/intrinsics Ref, If, Sub, GetAtt, ... type/bug

Comments

@pandithdurai
Copy link

pandithdurai commented Sep 24, 2020

Description:

Conditional statements not works in AWS::Serverless::Function Events

!If [condition, true, false]

  APILambda:
    Type: AWS::Serverless::Function
    DependsOn:
      - IAMLambda
    Properties:
      Events:
        HealthcheckEvent:
          Properties:
            RestApiId:
              Ref: APIGateway

            Path: /healthcheck
            Method: GET
            **Auth:
              ApiKeyRequired: !If [CreateProdResources, true, false]**

Observed result:
Not changing API Key required to true or false in conditional statements
Expected result:
It should change true from false or false from true when use conditional statements but nothing changes and no error message
sam_template.yml.txt

@hoffa
Copy link
Contributor

hoffa commented Oct 17, 2022

You might be able to get this to work by adding AWS::LanguageExtensions to Transform as such:

Transform:
  - AWS::LanguageExtensions
  - AWS::Serverless-2016-10-31

AWS::LanguageExtensions resolves intrinsic functions if the value is known when Transforms are run.

See #2533 for more information.

@hoffa
Copy link
Contributor

hoffa commented Nov 3, 2022

Closing in favor of #2533.

@hoffa hoffa closed this as completed Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/intrinsics Ref, If, Sub, GetAtt, ... type/bug
Projects
None yet
Development

No branches or pull requests

6 participants