Skip to content

Commit 844d407

Browse files
authored
fix(cognito): changing installLatestAwsSdk breaks Client Secret reference (#23798)
Because there wasn't previously a handler for `onUpdate` events, an empty object would be returned. When `installLatestAwsSdk` was changed to `false`, this was an update. Typically, updates aren't an issue because basically any other property being updated signifies a replacement. `installLatestAwsSdk` is just a very unique case where it doesn't (and where a user usually can't update it). When the empty object is returned, this results in an update failure in CloudFormation because the specific property isn't available. Fixes: #23796 ---- ### All Submissions: * [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Construct Runtime Dependencies: * [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent ce18037 commit 844d407

18 files changed

+1335
-9
lines changed

packages/@aws-cdk/aws-cognito/lib/user-pool-client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ export class UserPoolClient extends Resource implements IUserPoolClient {
451451
'DescribeCognitoUserPoolClient',
452452
{
453453
resourceType: 'Custom::DescribeCognitoUserPoolClient',
454-
onCreate: {
454+
onUpdate: {
455455
region: Stack.of(this).region,
456456
service: 'CognitoIdentityServiceProvider',
457457
action: 'describeUserPoolClient',
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"22.0.0"}
1+
{"version":"29.0.0"}

packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ-user-pool-client-explicit-props.assets.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "22.0.0",
2+
"version": "29.0.0",
33
"files": {
44
"a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476": {
55
"source": {
@@ -14,15 +14,15 @@
1414
}
1515
}
1616
},
17-
"be03a3e392c69c83e42480095a0bbc5f0bb315abc56be4db3af345689cf1505a": {
17+
"734cf8b4d966e3e725d80eb9076268d2066da8cd9e460447734d6f661bb4fba7": {
1818
"source": {
1919
"path": "integ-user-pool-client-explicit-props.template.json",
2020
"packaging": "file"
2121
},
2222
"destinations": {
2323
"current_account-current_region": {
2424
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25-
"objectKey": "be03a3e392c69c83e42480095a0bbc5f0bb315abc56be4db3af345689cf1505a.json",
25+
"objectKey": "734cf8b4d966e3e725d80eb9076268d2066da8cd9e460447734d6f661bb4fba7.json",
2626
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
2727
}
2828
}

packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ-user-pool-client-explicit-props.template.json

+24
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,30 @@
132132
]
133133
]
134134
},
135+
"Update": {
136+
"Fn::Join": [
137+
"",
138+
[
139+
"{\"region\":\"",
140+
{
141+
"Ref": "AWS::Region"
142+
},
143+
"\",\"service\":\"CognitoIdentityServiceProvider\",\"action\":\"describeUserPoolClient\",\"parameters\":{\"UserPoolId\":\"",
144+
{
145+
"Ref": "myuserpool01998219"
146+
},
147+
"\",\"ClientId\":\"",
148+
{
149+
"Ref": "myuserpoolmyuserpoolclientAFB2274E"
150+
},
151+
"\"},\"physicalResourceId\":{\"id\":\"",
152+
{
153+
"Ref": "myuserpoolmyuserpoolclientAFB2274E"
154+
},
155+
"\"}}"
156+
]
157+
]
158+
},
135159
"InstallLatestAwsSdk": false
136160
},
137161
"DependsOn": [

packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "22.0.0",
2+
"version": "29.0.0",
33
"testCases": {
44
"integ.user-pool-client-explicit-props": {
55
"stacks": [

packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/manifest.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "22.0.0",
2+
"version": "29.0.0",
33
"artifacts": {
44
"integ-user-pool-client-explicit-props.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}/be03a3e392c69c83e42480095a0bbc5f0bb315abc56be4db3af345689cf1505a.json",
20+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/734cf8b4d966e3e725d80eb9076268d2066da8cd9e460447734d6f661bb4fba7.json",
2121
"requiresBootstrapStackVersion": 6,
2222
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
2323
"additionalDependencies": [

packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/tree.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@
398398
"path": "Tree",
399399
"constructInfo": {
400400
"fqn": "constructs.Construct",
401-
"version": "10.1.189"
401+
"version": "10.1.216"
402402
}
403403
}
404404
},

packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js

+253
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":"29.0.0"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"version": "29.0.0",
3+
"files": {
4+
"a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476": {
5+
"source": {
6+
"path": "asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476",
7+
"packaging": "zip"
8+
},
9+
"destinations": {
10+
"current_account-current_region": {
11+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12+
"objectKey": "a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476.zip",
13+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
14+
}
15+
}
16+
},
17+
"23470f9d0cab672bb28f93d0b4cc009f579dd49d76249b541091db889df6aaae": {
18+
"source": {
19+
"path": "integ-user-pool-client-secret.template.json",
20+
"packaging": "file"
21+
},
22+
"destinations": {
23+
"current_account-current_region": {
24+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25+
"objectKey": "23470f9d0cab672bb28f93d0b4cc009f579dd49d76249b541091db889df6aaae.json",
26+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
27+
}
28+
}
29+
}
30+
},
31+
"dockerImages": {}
32+
}

0 commit comments

Comments
 (0)