Skip to content

Commit

Permalink
fix(apigateway): deployOptions.description is not used for deployment…
Browse files Browse the repository at this point in the history
…'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*
  • Loading branch information
woltsu authored Aug 22, 2023
1 parent 4997bca commit 6f9fcd6
Show file tree
Hide file tree
Showing 17 changed files with 182 additions and 169 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "30.0.0",
"version": "32.0.0",
"files": {
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
"source": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"30.0.0"}
{"version":"32.0.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "30.0.0",
"version": "32.0.0",
"testCases": {
"apigateway-restapi/DefaultTest": {
"stacks": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "30.0.0",
"version": "32.0.0",
"artifacts": {
"test-apigateway-restapi.assets": {
"type": "cdk:asset-manifest",
Expand All @@ -17,7 +17,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/94f416193221135915e06201345d08e3db001c8bbf22b073f16ec02d3b8fba4b.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c00b67076079aca10705c26d8b2f87803ff864e13c715f333bcec05a6e7021af.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down Expand Up @@ -54,7 +54,7 @@
"/test-apigateway-restapi/my-api/Deployment/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "myapiDeployment92F2CB496a6dee9579dae89ab3a0b094b4d193eb"
"data": "myapiDeployment92F2CB4993c0f175ba8d5964f5e1cc7bc64fe6e6"
}
],
"/test-apigateway-restapi/my-api/DeploymentStage.beta/Resource": [
Expand Down Expand Up @@ -198,7 +198,7 @@
"/test-apigateway-restapi/TestDeployment/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "TestDeploymentD77B56860a9c34c1bc306bfbc7d318827eacd1e1"
"data": "TestDeploymentD77B56865531eba1e8fde4b8e6988d5af7b2efd6"
}
],
"/test-apigateway-restapi/TestStage/Resource": [
Expand All @@ -225,19 +225,19 @@
"data": "CheckBootstrapVersion"
}
],
"myapiDeployment92F2CB4996088bac04ec19d9db88f146f3d88bca": [
"myapiDeployment92F2CB496a6dee9579dae89ab3a0b094b4d193eb": [
{
"type": "aws:cdk:logicalId",
"data": "myapiDeployment92F2CB4996088bac04ec19d9db88f146f3d88bca",
"data": "myapiDeployment92F2CB496a6dee9579dae89ab3a0b094b4d193eb",
"trace": [
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
]
}
],
"TestDeploymentD77B56866f3141cef1e8fea8ab3b3b8bc90df36d": [
"TestDeploymentD77B56860a9c34c1bc306bfbc7d318827eacd1e1": [
{
"type": "aws:cdk:logicalId",
"data": "TestDeploymentD77B56866f3141cef1e8fea8ab3b3b8bc90df36d",
"data": "TestDeploymentD77B56860a9c34c1bc306bfbc7d318827eacd1e1",
"trace": [
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "30.0.0",
"version": "32.0.0",
"files": {
"94f416193221135915e06201345d08e3db001c8bbf22b073f16ec02d3b8fba4b": {
"c00b67076079aca10705c26d8b2f87803ff864e13c715f333bcec05a6e7021af": {
"source": {
"path": "test-apigateway-restapi.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "94f416193221135915e06201345d08e3db001c8bbf22b073f16ec02d3b8fba4b.json",
"objectKey": "c00b67076079aca10705c26d8b2f87803ff864e13c715f333bcec05a6e7021af.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"myapi4C7BF186": {
"Type": "AWS::ApiGateway::RestApi",
"Properties": {
"Description": "api description",
"MinimumCompressionSize": 1024,
"Name": "my-api"
}
Expand Down Expand Up @@ -56,13 +57,13 @@
"UpdateReplacePolicy": "Retain",
"DeletionPolicy": "Retain"
},
"myapiDeployment92F2CB496a6dee9579dae89ab3a0b094b4d193eb": {
"myapiDeployment92F2CB4993c0f175ba8d5964f5e1cc7bc64fe6e6": {
"Type": "AWS::ApiGateway::Deployment",
"Properties": {
"RestApiId": {
"Ref": "myapi4C7BF186"
},
"Description": "Automatically created by the RestApi construct"
"Description": "beta stage"
},
"DependsOn": [
"myapiv1appliancesallGETC4DF552D",
Expand All @@ -88,7 +89,7 @@
"CacheClusterEnabled": true,
"CacheClusterSize": "0.5",
"DeploymentId": {
"Ref": "myapiDeployment92F2CB496a6dee9579dae89ab3a0b094b4d193eb"
"Ref": "myapiDeployment92F2CB4993c0f175ba8d5964f5e1cc7bc64fe6e6"
},
"Description": "beta stage",
"MethodSettings": [
Expand Down Expand Up @@ -673,7 +674,7 @@
"MyHandlerServiceRoleFFA06653"
]
},
"TestDeploymentD77B56860a9c34c1bc306bfbc7d318827eacd1e1": {
"TestDeploymentD77B56865531eba1e8fde4b8e6988d5af7b2efd6": {
"Type": "AWS::ApiGateway::Deployment",
"Properties": {
"RestApiId": {
Expand All @@ -696,7 +697,7 @@
"Ref": "myapi4C7BF186"
},
"DeploymentId": {
"Ref": "TestDeploymentD77B56860a9c34c1bc306bfbc7d318827eacd1e1"
"Ref": "TestDeploymentD77B56865531eba1e8fde4b8e6988d5af7b2efd6"
},
"StageName": "prod"
},
Expand Down
Loading

0 comments on commit 6f9fcd6

Please sign in to comment.