Describe the issue
Overview
In this documentation, I would like to note that when separating the stacks for RestApi and Resource, Deployment is not automatically created, and to avoid this issue, it is necessary to use Deployment.addToLogicalId().
Details
When a Resource is added to an IRestApi imported via RestApi.fromRestApiAttribute or RestApi.fromRestApiId, Deployment is not created, so the latest resource state is not associated with the API Gateway stage, which is a known issue.
This has been discussed in several issues, including the following:
We understand that it is not easy to automatically create Deployment, and there may be differing opinions on whether it should be fixed.
However, since there is no mention of this issue in the documentation, we feel that many developers who are separating stacks related to API Gateway may unintentionally create an environment where Deployment is not created.
Due to this issue, developers need to manually deploy to API Gateway after running cdk deploy.
While it is possible to share a workaround implementation, it is difficult to implement an automatic Deployment creation that detects changes in Resource without increasing complexity in the current configuration.
Therefore, we would like to propose adding a note to the documentation first.
Links
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway-readme.html#breaking-up-methods-and-resources-across-stacks
Describe the issue
Overview
In this documentation, I would like to note that when separating the stacks for
RestApiandResource,Deploymentis not automatically created, and to avoid this issue, it is necessary to useDeployment.addToLogicalId().Details
When a
Resourceis added to anIRestApiimported viaRestApi.fromRestApiAttributeorRestApi.fromRestApiId,Deploymentis not created, so the latest resource state is not associated with the API Gateway stage, which is a known issue.This has been discussed in several issues, including the following:
We understand that it is not easy to automatically create Deployment, and there may be differing opinions on whether it should be fixed.
However, since there is no mention of this issue in the documentation, we feel that many developers who are separating stacks related to API Gateway may unintentionally create an environment where
Deploymentis not created.Due to this issue, developers need to manually deploy to API Gateway after running
cdk deploy.While it is possible to share a workaround implementation, it is difficult to implement an automatic
Deploymentcreation that detects changes inResourcewithout increasing complexity in the current configuration.Therefore, we would like to propose adding a note to the documentation first.
Links
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway-readme.html#breaking-up-methods-and-resources-across-stacks