-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
50 lines (39 loc) · 1016 Bytes
/
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
import os
from aws_cdk import App, Environment
from cdk_aws_cross_account_lambda.stacks.lambda_stack import LambdaStack
from cdk_aws_cross_account_lambda.stacks.stepfunctions_stack import (
StepFunctionsStack,
)
def get_env_variable(name):
"""
Helper function to get an environment variable.
Raises an exception if the environment variable is not found.
"""
value = os.getenv(name)
if value is None:
raise ValueError(f"Environment variable '{name}' is not defined.")
return value
### ENVIRONMENTS ###
src_env = Environment(
account=get_env_variable("CDK_ACCOUNT_SRC"),
region=get_env_variable("CDK_REGION_SRC"),
)
trg_env = Environment(
account=get_env_variable("CDK_ACCOUNT_TRG"),
region=get_env_variable("CDK_REGION_TRG"),
)
### APP ###
app = App()
StepFunctionsStack(
app,
"src",
stack_name="StepFunctionsStack-src",
env=src_env,
)
LambdaStack(
app,
"trg",
stack_name="LambdaStack-trg",
env=trg_env,
)
app.synth()