-
Notifications
You must be signed in to change notification settings - Fork 34
/
app.py
executable file
·37 lines (27 loc) · 1.14 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
#!/usr/bin/env python3
from aws_cdk import core
import yaml
from infra.backstage import BackstageStack
from infra.infra_pipeline import InfraPipelineStack
# load yaml file and get key=value for env vars
with open("./configs/env-config.yaml") as conf_file:
config = yaml.full_load(conf_file)
# we want to fail here if these keys are not there
props = config['common']
stages = config['stages']
# start the naming circus
stack_name = props.get('TAG_STACK_NAME', 'backstage')
stacks = [
f"{stack_name}-pipeline",
stack_name
]
# Using a hosted dns zone requires specifying account and region,
# you will need active credentials for this account to synth/deploy
env =core.Environment(account=props.get('AWS_ACCOUNT'), region=props.get('AWS_REGION', 'us-east-1'))
app = core.App()
infra_pipeline = InfraPipelineStack(app, stacks[0] , stacks=stacks ,props=props, env=env)
backstage_infra = BackstageStack(app, stacks[1], props=props, stages=stages, env=env)
# be nice and tag all these resources so their are attributable
core.Tags.of(app).add("Name",stack_name)
core.Tags.of(app).add("Product",props.get('TAG_STACK_PRODUCT', 'dev-portal'))
app.synth()