Api Gateway Stage Logical Id is not always following the structure `LogicalId: <api‑LogicalId><stage‑name>Stage`

0

I use AWS::Serverless::Api to define a API Gateway resource in my SAM template. As per this blog: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-generated-resources-api.html, The Stage created should have a logical ID of the format <api‑LogicalId><stage‑name>Stage. My api‑LogicalId = Api, stage-name=dev. However the CFN stack ends up with a stage logical id called ApiStage with the correct stage value dev.

This is not the main issue though. Later when I transform the API resource and try to deploy it again, it tries to create a new Logical Id ApidevStage which follows the format, but the stack fails as the it already has a resource for the same api gateway stage but with a different logical Id ApiStage. How to ensure my CFN stack sticks to the same Logical Id for Stage?

Can we explicitly create a stage resource and refer to it inside AWS::Serverless::Api

No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions