serverless-application-model icon indicating copy to clipboard operation
serverless-application-model copied to clipboard

Intrinsic Functions for Domain in Serverless API do not work

Open christophsteiner opened this issue 6 years ago • 3 comments

Description:

Based on this documentation https://github.com/awslabs/serverless-application-model/blob/develop/docs/cloudformation_compatibility.rst#events-properties all intrinsic functions should work for the Domain Object of AWS::Serverless::Api. However if I try something like this.

APIGateway:
    Type: AWS::Serverless::Api
    Properties:
      StageName: Prod
      Domain:
        !If
          - CreateBasePath
          - DomainName: test
            CertificateArn: test
            EndpointConfiguration: REGIONAL
            Route53:
              HostedZoneId: test
          - !Ref "AWS::NoValue"
      Auth:
        Authorizers:
          LambdaTokenAuth:
            FunctionPayloadType: TOKEN # OPTIONAL; Defaults to 'TOKEN' when `FunctionArn` is specified
            FunctionArn: !GetAtt JWTAuthorizerFunction.Arn
            Identity:
              ReauthorizeEvery: 0

The deploy fails with: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Applica tion Specification document. Number of errors found: 1. Resource with id [APIGateway] is invalid. Custom Domains only w orks if both DomainName and CertificateArn are provided

I used similar if statements already for Policies and VpcConfig of a lambda function and there they worked perfectly.

Does anybody have an idea?

christophsteiner avatar Apr 20 '20 06:04 christophsteiner

This was also raised in #1435

brysontyrrell avatar Apr 26 '20 16:04 brysontyrrell

@keetonian Any updates on this? Is there at least a workaround? this has been open for a long time.

kakhaUrigashvili avatar Jun 08 '20 03:06 kakhaUrigashvili

closing in favor of https://github.com/aws/serverless-application-model/issues/1435

elbayaaa avatar Feb 12 '21 00:02 elbayaaa