Skip to content

Commit 6f9fcd6

Browse files
authored
fix(apigateway): deployOptions.description is not used for deployment's description (#26149)
When creating an instance of a `RestApi` construct, by default it has a `Deployment` attached to it. The description of the `Deployment` can be configured with an option given to the `RestApi`, like so: ```tsx const api = new RestApi(this, 'Api', { restApiName: 'MyApi', deployOptions: { description: 'Deployment description' } }); ``` However, looking at the [source code](https://github.com/aws/aws-cdk/blob/72eb1e957afb9d1573445999eddd38b5c345fa7a/packages/aws-cdk-lib/aws-apigateway/lib/restapi.ts#L592C25-L592C25), we see that instead of using the `props.deployOptions.description`, it uses `props.description`. Fixes #26148 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 4997bca commit 6f9fcd6

17 files changed

+182
-169
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/apigatewayrestapiDefaultTestDeployAssert6A9696A7.assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "30.0.0",
2+
"version": "32.0.0",
33
"files": {
44
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
55
"source": {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"30.0.0"}
1+
{"version":"32.0.0"}

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/integ.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "30.0.0",
2+
"version": "32.0.0",
33
"testCases": {
44
"apigateway-restapi/DefaultTest": {
55
"stacks": [

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/manifest.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "30.0.0",
2+
"version": "32.0.0",
33
"artifacts": {
44
"test-apigateway-restapi.assets": {
55
"type": "cdk:asset-manifest",
@@ -17,7 +17,7 @@
1717
"validateOnSynth": false,
1818
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
1919
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
20-
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/94f416193221135915e06201345d08e3db001c8bbf22b073f16ec02d3b8fba4b.json",
20+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c00b67076079aca10705c26d8b2f87803ff864e13c715f333bcec05a6e7021af.json",
2121
"requiresBootstrapStackVersion": 6,
2222
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
2323
"additionalDependencies": [
@@ -54,7 +54,7 @@
5454
"/test-apigateway-restapi/my-api/Deployment/Resource": [
5555
{
5656
"type": "aws:cdk:logicalId",
57-
"data": "myapiDeployment92F2CB496a6dee9579dae89ab3a0b094b4d193eb"
57+
"data": "myapiDeployment92F2CB4993c0f175ba8d5964f5e1cc7bc64fe6e6"
5858
}
5959
],
6060
"/test-apigateway-restapi/my-api/DeploymentStage.beta/Resource": [
@@ -198,7 +198,7 @@
198198
"/test-apigateway-restapi/TestDeployment/Resource": [
199199
{
200200
"type": "aws:cdk:logicalId",
201-
"data": "TestDeploymentD77B56860a9c34c1bc306bfbc7d318827eacd1e1"
201+
"data": "TestDeploymentD77B56865531eba1e8fde4b8e6988d5af7b2efd6"
202202
}
203203
],
204204
"/test-apigateway-restapi/TestStage/Resource": [
@@ -225,19 +225,19 @@
225225
"data": "CheckBootstrapVersion"
226226
}
227227
],
228-
"myapiDeployment92F2CB4996088bac04ec19d9db88f146f3d88bca": [
228+
"myapiDeployment92F2CB496a6dee9579dae89ab3a0b094b4d193eb": [
229229
{
230230
"type": "aws:cdk:logicalId",
231-
"data": "myapiDeployment92F2CB4996088bac04ec19d9db88f146f3d88bca",
231+
"data": "myapiDeployment92F2CB496a6dee9579dae89ab3a0b094b4d193eb",
232232
"trace": [
233233
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
234234
]
235235
}
236236
],
237-
"TestDeploymentD77B56866f3141cef1e8fea8ab3b3b8bc90df36d": [
237+
"TestDeploymentD77B56860a9c34c1bc306bfbc7d318827eacd1e1": [
238238
{
239239
"type": "aws:cdk:logicalId",
240-
"data": "TestDeploymentD77B56866f3141cef1e8fea8ab3b3b8bc90df36d",
240+
"data": "TestDeploymentD77B56860a9c34c1bc306bfbc7d318827eacd1e1",
241241
"trace": [
242242
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
243243
]

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/test-apigateway-restapi.assets.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"version": "30.0.0",
2+
"version": "32.0.0",
33
"files": {
4-
"94f416193221135915e06201345d08e3db001c8bbf22b073f16ec02d3b8fba4b": {
4+
"c00b67076079aca10705c26d8b2f87803ff864e13c715f333bcec05a6e7021af": {
55
"source": {
66
"path": "test-apigateway-restapi.template.json",
77
"packaging": "file"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "94f416193221135915e06201345d08e3db001c8bbf22b073f16ec02d3b8fba4b.json",
12+
"objectKey": "c00b67076079aca10705c26d8b2f87803ff864e13c715f333bcec05a6e7021af.json",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/test-apigateway-restapi.template.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"myapi4C7BF186": {
44
"Type": "AWS::ApiGateway::RestApi",
55
"Properties": {
6+
"Description": "api description",
67
"MinimumCompressionSize": 1024,
78
"Name": "my-api"
89
}
@@ -56,13 +57,13 @@
5657
"UpdateReplacePolicy": "Retain",
5758
"DeletionPolicy": "Retain"
5859
},
59-
"myapiDeployment92F2CB496a6dee9579dae89ab3a0b094b4d193eb": {
60+
"myapiDeployment92F2CB4993c0f175ba8d5964f5e1cc7bc64fe6e6": {
6061
"Type": "AWS::ApiGateway::Deployment",
6162
"Properties": {
6263
"RestApiId": {
6364
"Ref": "myapi4C7BF186"
6465
},
65-
"Description": "Automatically created by the RestApi construct"
66+
"Description": "beta stage"
6667
},
6768
"DependsOn": [
6869
"myapiv1appliancesallGETC4DF552D",
@@ -88,7 +89,7 @@
8889
"CacheClusterEnabled": true,
8990
"CacheClusterSize": "0.5",
9091
"DeploymentId": {
91-
"Ref": "myapiDeployment92F2CB496a6dee9579dae89ab3a0b094b4d193eb"
92+
"Ref": "myapiDeployment92F2CB4993c0f175ba8d5964f5e1cc7bc64fe6e6"
9293
},
9394
"Description": "beta stage",
9495
"MethodSettings": [
@@ -673,7 +674,7 @@
673674
"MyHandlerServiceRoleFFA06653"
674675
]
675676
},
676-
"TestDeploymentD77B56860a9c34c1bc306bfbc7d318827eacd1e1": {
677+
"TestDeploymentD77B56865531eba1e8fde4b8e6988d5af7b2efd6": {
677678
"Type": "AWS::ApiGateway::Deployment",
678679
"Properties": {
679680
"RestApiId": {
@@ -696,7 +697,7 @@
696697
"Ref": "myapi4C7BF186"
697698
},
698699
"DeploymentId": {
699-
"Ref": "TestDeploymentD77B56860a9c34c1bc306bfbc7d318827eacd1e1"
700+
"Ref": "TestDeploymentD77B56865531eba1e8fde4b8e6988d5af7b2efd6"
700701
},
701702
"StageName": "prod"
702703
},

0 commit comments

Comments
 (0)