From da7430f43d4b1efb8bd5c0c7b552fa6a4e56a9f9 Mon Sep 17 00:00:00 2001 From: hickeydh-aws <88673813+hickeydh-aws@users.noreply.github.com> Date: Tue, 22 Mar 2022 18:23:35 -0500 Subject: [PATCH] fix yaml load and log bucket output error (#947) * fixed raw config format to JSON * fixed log-bucket-config * Fixed log bucket output Co-authored-by: hickeydh-aws --- .../cdk/src/deployments/iam/step-1.ts | 18 +++++++++++------- src/lib/common/src/util/common.ts | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/deployments/cdk/src/deployments/iam/step-1.ts b/src/deployments/cdk/src/deployments/iam/step-1.ts index acae01c40..c7ccaf323 100644 --- a/src/deployments/cdk/src/deployments/iam/step-1.ts +++ b/src/deployments/cdk/src/deployments/iam/step-1.ts @@ -16,7 +16,7 @@ import * as iam from '@aws-cdk/aws-iam'; import { AccountStacks } from '../../common/account-stacks'; import { createRoleName } from '@aws-accelerator/cdk-accelerator/src/core/accelerator-name-generator'; import { CfnIamRoleOutput } from './outputs'; -import { LogBucketOutput, AccountBucketOutputFinder } from '../defaults/outputs'; +import { LogBucketOutput } from '../defaults/outputs'; import { StackOutput } from '@aws-accelerator/common-outputs/src/stack-output'; export interface IamConfigServiceRoleProps { @@ -35,12 +35,16 @@ export async function createConfigServiceRoles(props: IamConfigServiceRoleProps) const securityAccountKey = config.getMandatoryAccountKey('central-security'); const centralOperationsKey = config.getMandatoryAccountKey('central-operations'); const centralLogKey = config.getMandatoryAccountKey('central-log'); - - const logBucketDetails = LogBucketOutput.getBucket({ - accountStacks, - config, - outputs, - }); + let logBucketDetails; + try { + logBucketDetails = LogBucketOutput.getBucket({ + accountStacks, + config, + outputs, + }); + } catch (err) { + console.log('Log Bucket not created yet. Continuing.'); + } for (const accountKey of accountKeys) { const accountStack = accountStacks.tryGetOrCreateAccountStack(accountKey); diff --git a/src/lib/common/src/util/common.ts b/src/lib/common/src/util/common.ts index c1a57e450..7f9a16c4f 100644 --- a/src/lib/common/src/util/common.ts +++ b/src/lib/common/src/util/common.ts @@ -355,6 +355,6 @@ function enableGlobalRegion(config: string, rawConfig: string, format: FormatTyp } const configStr = getStringFromObject(configObj, format); - const rawConfigStr = getStringFromObject(rawConfigObj, format); + const rawConfigStr = getStringFromObject(rawConfigObj, JSON_FORMAT); return { configStr, rawConfigStr }; }