From 30df3c7aa5f9fbaa40f5849a749bbc2fb431e7c9 Mon Sep 17 00:00:00 2001 From: nachundu Date: Wed, 9 Sep 2020 19:19:57 +0530 Subject: [PATCH] added option to exclude alb deployment on a workload account --- .../master-config-sample-snippets/sample_snippets.md | 12 ++++++++++++ src/deployments/cdk/src/deployments/alb/step-1.ts | 10 +++++++++- src/lib/common-config/src/index.ts | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/reference-artifacts/master-config-sample-snippets/sample_snippets.md b/reference-artifacts/master-config-sample-snippets/sample_snippets.md index 028da0188..c5b526266 100644 --- a/reference-artifacts/master-config-sample-snippets/sample_snippets.md +++ b/reference-artifacts/master-config-sample-snippets/sample_snippets.md @@ -4,6 +4,18 @@ --- +- Added an option to exclude the alb deployment on a specific workload account + +``` + "workload-account-configs": { + "fun-acct": { + "exclude-ou-albs": true + } + } +``` + +--- + - Update Central Logging Kinesis stream shard count as accounts are added ``` diff --git a/src/deployments/cdk/src/deployments/alb/step-1.ts b/src/deployments/cdk/src/deployments/alb/step-1.ts index 817005f85..2dfd620bc 100644 --- a/src/deployments/cdk/src/deployments/alb/step-1.ts +++ b/src/deployments/cdk/src/deployments/alb/step-1.ts @@ -38,11 +38,19 @@ export async function step1(props: AlbStep1Props) { }); const vpcConfigs = config.getVpcConfigs(); - for (const { accountKey, albs: albConfigs } of config.getAlbConfigs()) { + for (const { ouKey, accountKey, albs: albConfigs } of config.getAlbConfigs()) { if (albConfigs.length === 0) { continue; } + if (ouKey) { + const accountConfigs = config.getAccountConfigsForOu(ouKey); + const accountConfig = accountConfigs.find(([aKey, _]) => aKey === accountKey); + if (accountConfig && accountConfig[1]['exclude-ou-albs']) { + continue; + } + } + for (const albConfig of albConfigs) { const vpcConfig = vpcConfigs.find(v => v.vpcConfig.name === albConfig.vpc)?.vpcConfig; if (!vpcConfig) { diff --git a/src/lib/common-config/src/index.ts b/src/lib/common-config/src/index.ts index 3e20e6564..b96c8d2e9 100644 --- a/src/lib/common-config/src/index.ts +++ b/src/lib/common-config/src/index.ts @@ -552,6 +552,7 @@ export const MandatoryAccountConfigType = t.interface({ 'cwl-retention': optional(t.number), deleted: fromNullable(t.boolean, false), 'src-filename': t.string, + 'exclude-ou-albs': optional(t.boolean), }); export type MandatoryAccountConfig = t.TypeOf;