Skip to content

Commit 2a9d6c9

Browse files
authored
Merge pull request #12 from gammarers/feature/cdk-version-upgrade-with-custom-resource-naming-change
feat: cdk version upgrade with custom resource naming change
2 parents 482da3c + 5e08922 commit 2a9d6c9

17 files changed

+180
-39
lines changed

.projen/deps.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projenrc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { awscdk, javascript } from 'projen';
22
const project = new awscdk.AwsCdkConstructLibrary({
33
author: 'yicr',
44
authorAddress: '[email protected]',
5-
cdkVersion: '2.100.0',
5+
cdkVersion: '2.145.0',
66
defaultReleaseBranch: 'main',
77
typescriptVersion: '5.5.x',
88
jsiiVersion: '5.5.x',

API.md

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const codeConnectionsHostCustomResource = new CodeConnectionsHostCustomResource(
3737
});
3838

3939
// get host arn
40-
const hostArn = codeConnectionsHostCustomResource.getResponseField('HostArn');
40+
const hostArn = gitLabSelfManagedConnectionHostCustomResource.findHostArn();
4141

4242
new codeconnections.CfnConnection(this, 'Connection', {
4343
connectionName: 'example-gitlab-connection',

package.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export enum CodeConnectionsHostProviderType {
1313
GIT_LAB_SELF_MANAGED = 'GitLabSelfManaged',
1414
}
1515

16+
export enum ResponseField {
17+
HOST_ARN = 'HostArn',
18+
}
19+
1620
export interface CodeConnectionsHostCustomResourceProps {
1721
readonly name: string;
1822
readonly providerEndpoint: string;
@@ -25,7 +29,7 @@ export class CodeConnectionsHostCustomResource extends cr.AwsCustomResource {
2529

2630
// 👇 Create random 8 length string
2731
const random: string = crypto.createHash('shake256', { outputLength: 4 })
28-
.update(cdk.Names.uniqueId(scope))
32+
.update(`${cdk.Names.uniqueId(scope)}.${props.name}.${props.providerEndpoint}.${props.providerType}`)
2933
.digest('hex');
3034

3135
const account = cdk.Stack.of(scope).account;
@@ -89,4 +93,9 @@ export class CodeConnectionsHostCustomResource extends cr.AwsCustomResource {
8993
},
9094
});
9195
}
96+
97+
findHostArn(): string {
98+
return this.getResponseField(ResponseField.HOST_ARN);
99+
}
100+
92101
}

test/__snapshots__/custom-resource.bitbucket.test.ts.snap

Lines changed: 16 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/__snapshots__/custom-resource.github-enterprise.test.ts.snap

Lines changed: 16 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/__snapshots__/custom-resource.github.test.ts.snap

Lines changed: 16 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/__snapshots__/custom-resource.gitlab-self-managed.test.ts.snap

Lines changed: 16 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)