forked from aws-samples/aws-cdk-cicd-boot-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppConfig.ts
68 lines (64 loc) · 3.02 KB
/
AppConfig.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT-0
import * as codebuild from 'aws-cdk-lib/aws-codebuild';
import { IAppConfig, ICodeBuildEnvSettings, RepositoryType } from './Types';
import { Environment } from './Utils';
import { VpcType } from './VpcConfig';
import { CodeGuruSeverityThreshold } from '../lib/cdk-pipeline/core/constructs/CodeGuruSecurityStepConstruct';
export const codeBuildEnvSettings: ICodeBuildEnvSettings = {
isPrivileged: true,
buildImage: codebuild.LinuxBuildImage.STANDARD_7_0,
synthOutputDirectory: Environment.getEnvVar('npm_package_config_synthOutputDirectory', './cdk.out'),
};
const region: string = Environment.getEnvVar('AWS_REGION');
const deploymentAccounts = {
RES: Environment.getEnvVar('ACCOUNT_RES'),
DEV: Environment.getEnvVar('ACCOUNT_DEV'),
INT: Environment.getEnvVar('ACCOUNT_INT'),
};
export const AppConfig: IAppConfig = {
applicationName: Environment.getEnvVar('npm_package_config_applicationName'),
deploymentAccounts: deploymentAccounts,
applicationQualifier: Environment.getEnvVar('npm_package_config_cdkQualifier'),
region: region,
logRetentionInDays: '365',
codeBuildEnvSettings: codeBuildEnvSettings,
codeGuruScanThreshold: CodeGuruSeverityThreshold.HIGH,
vpc: {
type: Environment.getEnvVar('CICD_VPC_TYPE', '') as VpcType || Environment.getEnvVar('npm_package_config_cicdVpcType') as VpcType,
VPC: {
// preserving original functionality where vpc is created from defaults.
cidrBlock: Environment.getEnvVar('CICD_VPC_CIDR', '') || Environment.getEnvVar('npm_package_config_cicdVpcCidr', '172.31.0.0/20'),
subnetCidrMask: parseInt(Environment.getEnvVar('CICD_VPC_CIDR_MASK', '') || Environment.getEnvVar('npm_package_config_cicdVpcCidrMask', '24')),
maxAzs: parseInt(Environment.getEnvVar('CICD_VPC_MAXAZS', '') || Environment.getEnvVar('npm_package_config_cicdVpcMaxAZs', '2')),
},
VPC_FROM_LOOK_UP: {
vpcId: Environment.getEnvVar('CICD_VPC_ID', '') || Environment.getEnvVar('npm_package_config_cicdVpcId', ''),
},
},
proxy: {
proxySecretArn: Environment.getEnvVar('PROXY_SECRET_ARN', ''),
noProxy: [`${region}.amazonaws.com`],
proxyTestUrl: 'https://docs.aws.amazon.com',
},
repositoryConfig: {
selected: Environment.getEnvVar('npm_package_config_repositoryType') as RepositoryType,
GITHUB: {
name: Environment.getEnvVar('npm_package_config_repositoryName'),
codeStarConnectionArn: Environment.getEnvVar('CODESTAR_CONNECTION_ARN', ''),
branch: 'main',
},
CODECOMMIT: {
name: Environment.getEnvVar('npm_package_config_repositoryName'),
description: 'CodeCommit repository used for the CI/CD pipeline',
branch: 'main',
codeBuildConfig: codeBuildEnvSettings,
codeGuruReviewer: true,
},
},
complianceLogBucketName: {
RES: `compliance-log-${deploymentAccounts.RES}-${region}`,
DEV: `compliance-log-${deploymentAccounts.DEV}-${region}`,
INT: `compliance-log-${deploymentAccounts.INT}-${region}`,
},
};