aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

(aws-apigateway): RestApi does not support Mode attribute

Open grigorigoldman opened this issue 5 years ago • 6 comments

:question: General Issue

According to AWS docs https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-mode

For REST APIs created before March 29, 2021, the default is overwrite. Otherwise, the default value is merge.

The Question

I am using SpecRestApi class to define my API Gateway resource but there does not appear to be a mode attribute that allows me to change the default setting of merge to overwrite.

Environment

  • CDK CLI Version: 1.101.0
  • Module Version: 1.91.0
  • Node.js Version: v16.0.0
  • OS: macOS Catalina
  • Language (Version): TypeScript (3.9.9)

grigorigoldman avatar Apr 29 '21 01:04 grigorigoldman

I also ran into this issue. For now I'm adding this assuming this will be addressed in an upcoming release:

            // The default value of 'Mode' changed from 'overwrite' to 'merge'
            // on 3/29/2021 - we want our default to be overwrite.
            const cfnRestApi = this.specRestApi.node.defaultChild as CfnRestApi;
            cfnRestApi.addPropertyOverride('Mode', 'overwrite');

gsdwait avatar Apr 30 '21 12:04 gsdwait

Hmmm this is strange to me. You linked to the docs where CloudFormation talks about the property mode, however even in their resource specification there is no hint of the mode property. The only place I can find which mentions Mode in this context is the docs you linked. Let me look into this further

peterwoodworth avatar May 03 '21 19:05 peterwoodworth

@gsdwait Yep that works.

@peterwoodworth The only other place where I saw a reference to mode was in the api specs, see https://docs.aws.amazon.com/cli/latest/reference/apigateway/put-rest-api.html.

grigorigoldman avatar May 06 '21 02:05 grigorigoldman

Since this has been determined to be a missing Cloudformation component from their resource specification, I am adjusting this issue to be marked as a feature-request so it can be closed on implementation.

😸 😷

NGL321 avatar May 21 '21 18:05 NGL321

This is now available: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-apigateway.CfnRestApi.html#mode

peterwoodworth avatar Oct 08 '21 22:10 peterwoodworth

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions avatar Oct 08 '21 22:10 github-actions