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

Unable to specify AWS::NoValue for Domain property of AWS::Serverless::Api #2160

Closed
selcukcihan opened this issue Sep 22, 2021 · 4 comments
Closed
Labels
area/intrinsics Ref, If, Sub, GetAtt, ... type/feature

Comments

@selcukcihan
Copy link

Description:

I'd like to selectively create a custom domain for an API, based on a condition. This currently fails with:

Custom Domains only works if both DomainName and CertificateArn are provided.

Steps to reproduce:

Resources:
  MyApi:
    Type: AWS::Serverless::Api
    Properties:
      EndpointConfiguration:
        Type: EDGE
      Domain: !If [UseCustomDomain, !Ref "AWS::NoValue", !Ref "AWS::NoValue"]

Parameters:
  TemporaryStack:
    Type: String
    Default: "FALSE"
    AllowedValues:
      - "FALSE"
      - "TRUE"
    Description: Specify "TRUE" if the stack is for a temporary branch.

Conditions:
  UseCustomDomain: !Equals 
    - !Sub "${TemporaryStack}"
    - "FALSE"

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: macOS Catalina
  2. If using SAM CLI, sam --version: SAM CLI, version 1.24.0
  3. AWS region: eu-west-1
@CoshUS CoshUS added type/feature area/intrinsics Ref, If, Sub, GetAtt, ... labels Sep 22, 2021
@CoshUS
Copy link
Contributor

CoshUS commented Sep 22, 2021

Reproduced. The Domain property in SAM currently does not support intrinsics.

@brysontyrrell
Copy link
Contributor

This is a recurring issue around conditional attributes. See #1435 and #1955

@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/feature
Projects
None yet
Development

No branches or pull requests

5 participants