Skip to content
This repository was archived by the owner on Dec 31, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions reference-artifacts/Custom-Scripts/lza-upgrade/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,41 +45,41 @@
"prettier": "^3.1.0",
"prettier-eslint": "^16.1.2",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^4.4.4"
"ts-node": "^10.9.2",
"typescript": "^5.8.2"
},
"dependencies": {
"@aws-sdk/client-accessanalyzer": "^3.504.0",
"@aws-sdk/client-acm": "^3.504.0",
"@aws-sdk/client-cloudformation": "^3.504.0",
"@aws-sdk/client-cloudtrail": "^3.504.0",
"@aws-sdk/client-cloudwatch": "^3.504.0",
"@aws-sdk/client-cloudwatch-logs": "^3.504.0",
"@aws-sdk/client-codecommit": "^3.504.0",
"@aws-sdk/client-config-service": "^3.504.0",
"@aws-sdk/client-cost-and-usage-report-service": "^3.504.0",
"@aws-sdk/client-dynamodb": "^3.504.0",
"@aws-sdk/client-ec2": "^3.504.0",
"@aws-sdk/client-ecr": "^3.504.0",
"@aws-sdk/client-eventbridge": "^3.504.0",
"@aws-sdk/client-fms": "^3.504.0",
"@aws-sdk/client-guardduty": "^3.504.0",
"@aws-sdk/client-iam": "^3.504.0",
"@aws-sdk/client-kms": "^3.504.0",
"@aws-sdk/client-macie2": "^3.504.0",
"@aws-sdk/client-organizations": "^3.504.0",
"@aws-sdk/client-route-53": "^3.504.0",
"@aws-sdk/client-route53resolver": "^3.504.0",
"@aws-sdk/client-s3": "^3.504.0",
"@aws-sdk/client-s3-control": "^3.504.0",
"@aws-sdk/client-securityhub": "^3.504.0",
"@aws-sdk/client-ssm": "^3.504.0",
"@aws-sdk/client-sts": "^3.504.0",
"@aws-sdk/credential-provider-node": "^3.504.0",
"@aws-sdk/lib-dynamodb": "^3.504.0",
"@aws-sdk/client-accessanalyzer": "^3.777.0",
"@aws-sdk/client-acm": "^3.777.0",
"@aws-sdk/client-cloudformation": "^3.777.0",
"@aws-sdk/client-cloudtrail": "^3.777.0",
"@aws-sdk/client-cloudwatch": "^3.777.0",
"@aws-sdk/client-cloudwatch-logs": "^3.777.0",
"@aws-sdk/client-codecommit": "^3.777.0",
"@aws-sdk/client-config-service": "^3.777.0",
"@aws-sdk/client-cost-and-usage-report-service": "^3.777.0",
"@aws-sdk/client-dynamodb": "^3.777.0",
"@aws-sdk/client-ec2": "^3.777.0",
"@aws-sdk/client-ecr": "^3.777.0",
"@aws-sdk/client-eventbridge": "^3.777.0",
"@aws-sdk/client-fms": "^3.777.0",
"@aws-sdk/client-guardduty": "^3.777.0",
"@aws-sdk/client-iam": "^3.777.0",
"@aws-sdk/client-kms": "^3.777.0",
"@aws-sdk/client-macie2": "^3.777.0",
"@aws-sdk/client-organizations": "^3.777.0",
"@aws-sdk/client-route-53": "^3.777.0",
"@aws-sdk/client-route53resolver": "^3.777.0",
"@aws-sdk/client-s3": "^3.777.0",
"@aws-sdk/client-s3-control": "^3.777.0",
"@aws-sdk/client-securityhub": "^3.777.0",
"@aws-sdk/client-ssm": "^3.777.0",
"@aws-sdk/client-sts": "^3.777.0",
"@aws-sdk/credential-provider-node": "^3.777.0",
"@aws-sdk/lib-dynamodb": "^3.777.0",
"@aws-sdk/smithy-client": "^3.374.0",
"@aws-sdk/types": "^3.502.0",
"aws-sdk": "^2.1231.0",
"aws-sdk": "^2.1692.0",
"cacheable-lookup": "7.0.0",
"exponential-backoff": "^3.1.0",
"fast-json-stable-stringify": "^2.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ export class ConvertAseaConfig {
case globalOptions['aws-org-management'].account:
return AccountsConfig.MANAGEMENT_ACCOUNT;
default:
return accountKey;
return accountKey.replaceAll(' ', '');
}
}

Expand Down Expand Up @@ -1334,7 +1334,7 @@ export class ConvertAseaConfig {
return;
}
if (accountKey) {
roleSets[currentIndex].deploymentTargets.accounts?.push(accountKey);
roleSets[currentIndex].deploymentTargets.accounts?.push(this.getAccountKeyforLza(this.globalOptions!, accountKey));
}
if (ouKey) {
const ous = this.getNestedOusForDeploymentTargets([ouKey]);
Expand Down Expand Up @@ -1679,13 +1679,13 @@ export class ConvertAseaConfig {
const nestedOu = accountConfig['ou-path'];
if (!ignoredOus.includes(accountConfig.ou) && !accountConfig.deleted) {
accountsConfig.workloadAccounts.push({
name: accountKey,
name: this.getAccountKeyforLza(aseaConfig['global-options'], accountKey),
description: accountConfig.description,
email: accountConfig.email.toLocaleLowerCase(),
organizationalUnit: nestedOu ? accountConfig['ou-path'] : accountConfig.ou,
warm: false,
});
accountKeys.push(accountKey);
accountKeys.push(this.getAccountKeyforLza(aseaConfig['global-options'], accountKey));
}
});

Expand Down Expand Up @@ -2459,7 +2459,7 @@ export class ConvertAseaConfig {
accountConfig['aws-config'].filter((c) => c['excl-rules'].find((r) => r.includes(configRule.name)))
.length > 0
) {
excludedAccounts.push(accountKey);
excludedAccounts.push(this.getAccountKeyforLza(this.globalOptions!, accountKey));
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export class Preparation {
}

async prepareLza() {
await getLZAInstallerStackTemplate('solutions-reference', '../../outputs');
await putLZAInstallerStackTemplate(this.config.aseaConfigBucketName, '../../outputs', this.homeRegion);
await getLZAInstallerStackTemplate('solutions-reference');
await putLZAInstallerStackTemplate(this.config.aseaConfigBucketName, this.homeRegion);
const installerStackParameters: InstallerStackParameters = {
repositorySource: this.config.lzaCodeRepositorySource ?? 'github',
repositoryOwner: this.config.lzaCodeRepositoryOwner ?? 'awslabs',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export async function createLZAInstallerCloudFormationStack(
}
}

export async function getLZAInstallerStackTemplate(bucketName: string, outputPath: string) {
export async function getLZAInstallerStackTemplate(bucketName: string) {
const s3Client = new S3Client({ endpoint: 'https://s3.amazonaws.com', region: 'us-east-1' });
const template = await s3Client.send(
new GetObjectCommand({
Expand All @@ -162,13 +162,13 @@ export async function getLZAInstallerStackTemplate(bucketName: string, outputPat

await pipeline(
template.Body as Readable,
fs.createWriteStream(path.join(__dirname, outputPath, 'AWSAccelerator-InstallerStack.template')),
fs.createWriteStream(path.join(__dirname, 'AWSAccelerator-InstallerStack.template')),
);
}

export async function putLZAInstallerStackTemplate(bucketName: string, templatePath: string, region: string) {
export async function putLZAInstallerStackTemplate(bucketName: string, region: string) {
const s3Client = new S3Client({ region });
const template = fs.readFileSync(path.join(__dirname, templatePath, 'AWSAccelerator-InstallerStack.template'));
const template = fs.readFileSync(path.join(__dirname, 'AWSAccelerator-InstallerStack.template'));
await s3Client.send(
new PutObjectCommand({
Bucket: bucketName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ export class ResourceMapping {
for (const region of regions) {
accountDiscovery.push({
accountId: account.id,
accountKey: account.key,
accountKey: account.key.replaceAll(' ', ''),
region,
});
}
Expand Down
Loading