Skip to content

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

Closed
@selcukcihan

Description

@selcukcihan

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions