Skip to content

Multiple AWS::Serverless::Api only yields single record set #1829

Description

@Matthew-Beckett

Description:

When creating multiple AWS::Serverless::Api resources, with Domain and Route53 properties, only one gateway has a record set created when rendered to CloudFormation template from SAM.

  ApiGatewayAdmin:
    Type: AWS::Serverless::Api
    Properties:
      Name: !Join ["-", ["App", !Ref EnvironmentName, "Web"]]
      StageName: !Ref EnvironmentName
      TracingEnabled: true
      MethodSettings:
        - LoggingLevel: Info
          ResourcePath: '/*'
          HttpMethod: '*'
      Domain:
        DomainName: !Join [".", ["admin", !Ref EnvironmentName, !Ref DomainName]]
        CertificateArn: !Ref Certificate
        EndpointConfiguration: REGIONAL
        Route53:
          HostedZoneId: !Ref HostedZone
      EndpointConfiguration:
        Type: REGIONAL

I have three objects exactly identical as above with only changes to the DomainName to make it unique and possibly co-incidentally, the API which successfully has its record set created is the final API object in the YAML before function definitions.

Steps to reproduce:

  • Create three API resources, with DomainName and Route53 configuration sharing the same hosted zone
  • Render template to CloudFormation

Observed result:

CloudFormation template output only contains a single record set, in my case, the last defined API resource.

Expected result:

A record set and domain name for each API resource

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

  1. OS: MacOS, Linux (Alpine, Ubuntu)
  2. sam --version: SAM CLI, version 1.2.0

Add --debug flag to command you are running

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