-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
53 lines (43 loc) · 1.34 KB
/
main.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
#!/usr/bin/env python
"""
"""
import os
from pathlib import Path
from cdktf import App, TerraformStack, S3Backend
from cdktf_cdktf_provider_aws.provider import AwsProvider
from constructs import Construct
from infra import (
SimpleLambdaFunc,
SimpleLambdaFuncConfig,
)
ROOTDIR = Path(__file__).parent
class MyRustLambdaStack(TerraformStack):
"""Stack that creates some examples for rust lambdas"""
def __init__(self, scope: Construct, id: str):
super().__init__(scope, id)
AwsProvider(self, "aws", region="eu-central-1")
S3Backend(
self,
bucket=os.getenv("TFSTATE_BUCKET"),
key=os.getenv("TFSTATE_KEY"),
region=os.getenv("AWS_REGION"),
dynamodb_table=os.getenv("TFSTATE_LOCKTABLE"),
)
SimpleLambdaFunc(
self,
"simple_lambda",
SimpleLambdaFuncConfig(
name="SimpleRustLambda",
memory=128,
description="A super simple lambda that does nothing!",
artefact=ROOTDIR.joinpath(
"./lambdas/simplelambda/target/lambda/simplelambda/bootstrap.zip"
),
),
)
def main():
app = App(stack_traces=False)
MyRustLambdaStack(app, "rust_lambda_stack")
app.synth()
if __name__ == "__main__":
main()