@@ -7,5 +7,117 @@ External Resources module to provision and manage RDS instances in AWS with App-
7
7
* Terraform CDKTF
8
8
* AWS provider
9
9
* Random provider
10
- * Python 3.11
10
+ * Python 3.12
11
11
* Pydantic
12
+
13
+ ## Development
14
+
15
+ Ensure ` uv ` is installed.
16
+
17
+ Prepare local development environment:
18
+
19
+ ``` shell
20
+ make dev
21
+ ```
22
+
23
+ This will auto create a ` venv ` , to activate in shell:
24
+
25
+ ``` shell
26
+ source .venv/bin/activate
27
+ ```
28
+
29
+ Optional config ` .env ` :
30
+
31
+ ``` shell
32
+ cp .env.example .env
33
+ ```
34
+
35
+ Edit ` .env ` file with credentials
36
+
37
+ ``` shell
38
+ qontract-cli --config $CONFIG get aws-creds $ACCOUNT
39
+ ```
40
+
41
+ Export to current shell
42
+
43
+ ``` shell
44
+ source .env
45
+ ```
46
+
47
+ ## Debugging
48
+
49
+ Export ` input.json ` via ` qontract-cli ` and place it in the current project root dir.
50
+
51
+ ``` shell
52
+ qontract-cli --config $CONFIG external-resources --provisioner $PROVISIONER --provider $PROVIDER --identifier $IDENTIFIER get-input > input.json
53
+ ```
54
+
55
+ ### On Host
56
+
57
+ Ensure ` cdktf ` is installed
58
+
59
+ ``` shell
60
+ npm install --global
[email protected]
61
+ ```
62
+
63
+ Generate terraform config.
64
+
65
+ ``` shell
66
+ ER_INPUT_FILE=" $PWD " /input.json cdktf synth
67
+ ```
68
+
69
+ Ensure AWS credentials set in current shell, then use ` terraform ` to verify.
70
+
71
+ ``` shell
72
+ cd cdktf.out/stakcs/CDKTF
73
+ terraform init
74
+ terraform plan -out=plan
75
+ terraform show -json plan > plan.json
76
+ ```
77
+
78
+ Test validation logic
79
+
80
+ ``` shell
81
+ cd ../../..
82
+ ER_INPUT_FILE=" $PWD " /input.json python hooks/validate_plan.py cdktf.out/stacks/CDKTF/plan.json
83
+ ```
84
+
85
+ ### In Container
86
+
87
+ Build image first
88
+
89
+ ``` shell
90
+ make build
91
+ ```
92
+
93
+ Start container
94
+
95
+ ``` shell
96
+ docker run --rm -ti \
97
+ --entrypoint /bin/bash \
98
+ --mount type=bind,source=$PWD /input.json,target=/inputs/input.json \
99
+ --env-file .env \
100
+ er-aws-rds:prod
101
+ ```
102
+
103
+ Generate terraform config.
104
+
105
+ ``` shell
106
+ cdktf synth
107
+ ```
108
+
109
+ Use ` terraform ` to verify.
110
+
111
+ ``` shell
112
+ cd cdktf.out/stakcs/CDKTF
113
+ terraform init
114
+ terraform plan -out=plan
115
+ terraform show -json plan > plan.json
116
+ ```
117
+
118
+ Test validation logic
119
+
120
+ ``` shell
121
+ cd ../../..
122
+ python hooks/validate_plan.py cdktf.out/stacks/CDKTF/plan.json
123
+ ```
0 commit comments