-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
77 lines (61 loc) · 1.6 KB
/
app.py
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
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python3
import aws_cdk as cdk
from infrastructure.backend.backend_stack import BackendStack
from infrastructure.imagebuild.imagebuild_stack import ImagebuildStack
from infrastructure.api.api_stack import APIStack
from tests.nag.nag_test import NAGTest
from utils.environment import Environment
# --------------------------------
# Set stack environment variables
# --------------------------------
PROJECT_NAME = Environment.PROJECT_NAME
IMAGE_TYPE = Environment.IMAGE_TYPE
ENV = cdk.Environment(
account=Environment.AWS_ACCOUNT_ID, region=Environment.AWS_REGION
)
# --------------------------------
# Initialize App
# --------------------------------
app = cdk.App()
# --------------------------------
# Backend
# --------------------------------
backend = BackendStack(
scope=app,
construct_id=f"{PROJECT_NAME}-backend",
env=ENV,
)
# --------------------------------
# Imagebuilds
# --------------------------------
build = ImagebuildStack(
scope=app,
construct_id=f"{PROJECT_NAME}-{IMAGE_TYPE}",
backend=backend,
image_type=IMAGE_TYPE,
env=ENV,
)
builds = [build]
# --------------------------------
# APIs
# --------------------------------
api = APIStack(
scope=app,
construct_id=f"{PROJECT_NAME}-api",
backend=backend,
pipeline=build,
env=ENV,
)
# --------------------------------
# Nag Test
# --------------------------------
if Environment.RUN_NAG:
NAGTest.run(
app=app,
api=api,
backend=backend,
builds=builds,
)
# --------------------------------
cdk.Tags.of(app).add("project", PROJECT_NAME)
app.synth()