Skip to content

Commit 5c3122e

Browse files
Fix number account name (#1015)
* removed debugging logging * fixed account stacks that start with a number Co-authored-by: hickeydh-aws <hickeydh@amazon.com> Co-authored-by: Brian969 <56414362+Brian969@users.noreply.github.com>
1 parent 77e7908 commit 5c3122e

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/deployments/cdk/src/common/account-stacks.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,19 @@ export class AccountStacks {
196196
protected createStackLogicalId(accountKey: string, region: string, suffix?: string) {
197197
// BE CAREFUL CHANGING THE STACK LOGICAL ID
198198
// When changed, it will generate new logical IDs for all resources in this stack and recreate all resources!
199-
const accountPrettyName = pascalCase(accountKey);
199+
let accountPrettyName = pascalCase(accountKey);
200+
if (this.startsWithNum(accountPrettyName)) {
201+
accountPrettyName = `a${accountPrettyName}`;
202+
}
200203
const suffixPretty = suffix ? pascalCase(suffix) : '';
201204
const regionPrettyName = region === this.props.context.defaultRegion ? '' : pascalCase(region);
202205
const stackConstructId = !suffix
203206
? `${accountPrettyName}Phase${this.props.phase}${regionPrettyName}`
204207
: `${accountPrettyName}Phase${this.props.phase}${regionPrettyName}${suffixPretty}`;
205208
return stackConstructId;
206209
}
210+
211+
startsWithNum = (expression: string) => {
212+
return new RegExp(/^\d/).test(expression);
213+
};
207214
}

src/deployments/cdk/src/common/vpc.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,6 @@ export class Vpc extends cdk.Construct implements constructs.Vpc {
368368
availabilityZone,
369369
outpostArn: subnetDefinition['outpost-arn'],
370370
});
371-
if (availabilityZone.length > 1) {
372-
console.log(subnet);
373-
}
374371
for (const extensions of extendVpc) {
375372
subnet.addDependsOn(extensions);
376373
}

src/lib/cdk-plugin-assume-role/src/assume-role-provider-source.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class AssumeRoleProviderSource implements CredentialProviderSource {
7171
endpoint = `sts.${region}.amazonaws.com`;
7272
}
7373
const sts = new aws.STS({ endpoint, region });
74-
const assumeRoleResponse = await throttlingBackOff(() =>
74+
return await throttlingBackOff(() =>
7575
sts
7676
.assumeRole({
7777
RoleArn: roleArn,
@@ -80,8 +80,5 @@ export class AssumeRoleProviderSource implements CredentialProviderSource {
8080
})
8181
.promise(),
8282
);
83-
84-
console.log(assumeRoleResponse);
85-
return assumeRoleResponse;
8683
}
8784
}

0 commit comments

Comments
 (0)