awslabs / landing-zone-accelerator-on-aws

Deploy a multi-account cloud foundation to support highly-regulated workloads and complex compliance requirements.
https://aws.amazon.com/solutions/implementations/landing-zone-accelerator-on-aws/
Apache License 2.0
547 stars 436 forks source link

Request to pickup errors earlier in the LZA Pipeline stages #464

Closed jacido closed 4 months ago

jacido commented 4 months ago

Is your feature request related to a problem? Please describe. Error encountered:

Container] 2024/05/13 20:42:22.620799 Running command if [ -z "${ACCELERATOR_STAGE}" ]; then for STAGE in "key" "logging" "organizations" "security-audit" "network-prep" "security" "operations" "network-vpc" "security-resources" "network-associations" "customizations" "finalize" "bootstrap"; do set -e && yarn run ts-node --transpile-only cdk.ts synth --require-approval never --config-dir $CODEBUILD_SRC_DIR_Config --partition aws --stage $STAGE; done; fi yarn run v1.22.19 $ /codebuild/output/src2898/src/s3/00/source/packages/@aws-accelerator/accelerator/node_modules/.bin/ts-node --transpile-only cdk.ts synth --require-approval never --config-dir /codebuild/output/src2898/src/s3/01 --partition aws --stage key Done in 67.47s. yarn run v1.22.19 $ /codebuild/output/src2898/src/s3/00/source/packages/@aws-accelerator/accelerator/node_modules/.bin/ts-node --transpile-only cdk.ts synth --require-approval never --config-dir /codebuild/output/src2898/src/s3/01 --partition aws --stage logging Done in 70.13s. yarn run v1.22.19 $ /codebuild/output/src2898/src/s3/00/source/packages/@aws-accelerator/accelerator/node_modules/.bin/ts-node --transpile-only cdk.ts synth --require-approval never --config-dir /codebuild/output/src2898/src/s3/01 --partition aws --stage organizations 2024-05-13 20:45:48.045 | error | app | Cannot read properties of undefined (reading 'indexOf') 2024-05-13 20:45:48.046 | error | toolkit | TypeError: Cannot read properties of undefined (reading 'indexOf') 2024-05-13 20:45:48.173 | error | accelerator | Runtime Error /codebuild/output/src2898/src/s3/00/source/packages/@aws-accelerator/accelerator/lib/accelerator.ts:58 throw new Error('Synthesis failed'); ^ Error: Synthesis failed at process. (/codebuild/output/src2898/src/s3/00/source/packages/@aws-accelerator/accelerator/lib/accelerator.ts:47:9) at process.emit (node:events:525:35) at process.emit (node:domain:489:12) at process.emit.sharedData.processEmitHook.installedValue [as emit] (/codebuild/output/src2898/src/s3/00/source/node_modules/@cspotcode/source-map-support/source-map-support.js:745:40) at process._fatalException (node:internal/process/execution:149:25) 2024-05-13 20:45:48.265 | error | toolkit | Subprocess exited with error 7 2024-05-13 20:45:48.266 | error | toolkit | Options were: {"command":"synth","enableSingleAccountMode":false,"partition":"aws","stackPrefix":"AWSAccelerator","stage":"organizations","configDirPath":"/codebuild/output/src2898/src/s3/01","requireApproval":"never","cdkOptions":{"centralizeBuckets":true,"useManagementAccessRole":true},"useExistingRoles":false} Synthesis of stacks failed error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Describe the feature you'd like

Requests that the error be caught at the earlier stages, when the config files syntax is checked.

Additional context

It appears that the excludeRegions[1] under S3 was missing was causing the error. After defining the security-config guardDuty the issue was resolved.


guardduty: enable: true excludeRegions: [] s3Protection: enable: true excludeRegions: [] exportConfiguration: enable: true destinationType: S3 exportFrequency: FIFTEEN_MINUTES


References: [1] - security-config.yaml/ excludeRegions https://github.com/awslabs/landing-zone-accelerator-on-aws/blob/main/reference/sample-configurations/lza-sample-config/security-config.yaml

bo1984 commented 4 months ago

We have validation scripts that run at the Prepare stage of the pipeline. If there are invalid values by way of missing property values that are required for certain objects, it's likely that this will fail at the Build stage of the pipeline. Which stage of the pipeline are you getting these errors at?

nagmesh commented 4 months ago

Hello, The fix is implemented in 1.7 release. Thank you for your interest in Landing Zone Accelerator on AWS.