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

AWS::Serverless::HttpApi does not support Name attribute

Open jkrebs opened this issue 6 years ago • 8 comments

AWS::Serverless::HttpApi transforms into AWS::ApiGatewayV2::Api but it is not possible to specify the Name attribute for the resulting API resource.

InvalidResourceException('HelloWorldApi', 'property Name not defined for resource of type AWS::Serverless::HttpApi')]

SAM CLI, version 0.52.0

https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-httpapi.html

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-api.html

jkrebs avatar Jun 06 '20 08:06 jkrebs

FWIW it doesn't support FailOnWarnings or CorsConfiguration either 😕

rowanu avatar Jun 08 '20 00:06 rowanu

@rowanu It supports both of those.

chrisoverzero avatar Jun 10 '20 23:06 chrisoverzero

Sorry, my mistake: I was seeing the same error same error message in SAM CLI when trying to run ApiGatewayV2 locally, so will move to that repo.

rowanu avatar Jun 11 '20 00:06 rowanu

AWS::Serverless::HttpApi Name will refer to stack_name. I created multiple HttpApi but the name shown in the console is the same name which is stack_name. So far I using Description attribute to differentiate the list of HttpApi.

  MainApiGateway:
    Type: AWS::Serverless::HttpApi
    Properties:
      # Name: !Sub ${ResourceEnv}-${ResourceProject}-MainApiGateway
      Description: !Sub ${ResourceEnv}-${ResourceProject}-MainApiGateway
      StageName: !Ref ResourceEnv

Hope got an update from the contributor that attribute Name can use in AWS::Serverless::HttpApi 😁

shukrikhalid avatar Aug 28 '21 15:08 shukrikhalid

Other serverless resources that have Name (or their variant) property:

  • AWS::Serverless::Api
  • AWS::Serverless::Function
  • AWS::Serverless::LayerVersion
  • AWS::Serverless::SimpleTable
  • AWS::Serverless::StateMachine

For consistency purpose, we should have it for "AWS::Serverless::HttpApi"

aahung avatar Sep 13 '21 04:09 aahung

Hey @mndeveci or @jfuss what would it take to add this? I see it's already supported in AWS::ApiGatewayV2::Api.

Outside of this repo, is there any other changes that would need to be made? I don't mind making a PR to support this

iRoachie avatar Dec 07 '21 14:12 iRoachie

Any update on this?

andresmiguel avatar Jun 20 '22 20:06 andresmiguel

pending doc update to https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-httpapi.html

aahung avatar Jan 05 '23 22:01 aahung