Skip to content

Commit 8d34a06

Browse files
committed
deploy: d39c4cf
1 parent 5ce226d commit 8d34a06

File tree

15 files changed

+748
-350
lines changed

15 files changed

+748
-350
lines changed

concepts/environment.md

Lines changed: 70 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Based on `example/e2e.yaml`:
2929
```yaml
3030
apiVersion: platform.io/v1
3131
kind: Environment
32+
gitProvider: github
3233

3334
metadata:
3435
name: example-aws
@@ -38,35 +39,84 @@ metadata:
3839
team: platform
3940
cost_center: shared
4041
stacks:
41-
- ./stack.yaml
42-
variables:
43-
base_domain: prod.pltf.internal
44-
secrets:
45-
api_key: {}
42+
- example-eks-stack
43+
# images:
44+
# - name: platform-tools
45+
# context: .
46+
# dockerfile: Dockerfile
47+
# platforms:
48+
# - linux/amd64
49+
# - linux/arm64
50+
# tags:
51+
# - ghcr.io/example/${layer_name}:${env_name}
52+
# buildArgs:
53+
# ENV: ${env_name}
4654
environments:
55+
dev:
56+
account: "556169302489"
57+
region: ap-northeast-1
58+
stage:
59+
account: "556169302489"
60+
region: ap-northeast-1
4761
prod:
4862
account: "556169302489"
4963
region: ap-northeast-1
64+
variables:
65+
replica_counts: '{"dev":1,"prod":3}'
66+
environment_settings: '{"region":"us-west-2","zones":["us-west-2a","us-west-2b"]}'
5067
modules:
51-
- id: base
52-
type: aws_base
53-
- id: dns
54-
type: aws_dns
55-
inputs:
56-
domain: ${{var.base_domain}}
57-
delegated: false
58-
- id: eks
59-
type: aws_eks
60-
inputs:
61-
cluster_name: "pltf-app-${layer_name}-${env_name}"
62-
k8s_version: 1.33
63-
enable_metrics: false
64-
max_nodes: 15
6568
- id: nodegroup1
66-
type: aws_nodegroup
69+
source: ../modules/aws_nodegroup
6770
inputs:
6871
max_nodes: 15
6972
node_disk_size: 20
73+
- id: postgres
74+
source: https://github.com/yindia/pltf.git//modules/aws_postgres?ref=main
75+
inputs:
76+
database_name: "${layer_name}-${env_name}"
77+
- id: s3
78+
type: aws_s3
79+
inputs:
80+
bucket_name: "pltf-app-${env_name}"
81+
links:
82+
readWrite:
83+
- adminpltfrole
84+
- userpltfrole
85+
- id: topic
86+
type: aws_sns
87+
inputs:
88+
sqs_subscribers:
89+
- "${module.notifcationsQueue.queue_arn}"
90+
links:
91+
read: adminpltfrole
92+
- id: notifcationsQueue
93+
type: aws_sqs
94+
inputs:
95+
fifo: false
96+
links:
97+
readWrite: adminpltfrole
98+
- id: schedulesQueue
99+
type: aws_sqs
100+
inputs:
101+
fifo: false
102+
links:
103+
readWrite: adminpltfrole
104+
- id: adminpltfrole
105+
type: aws_iam_role
106+
inputs:
107+
extra_iam_policies:
108+
- "arn:aws:iam::aws:policy/CloudWatchEventsFullAccess"
109+
allowed_k8s_services:
110+
- namespace: "*"
111+
service_name: "*"
112+
- id: userpltfrole
113+
type: aws_iam_role
114+
inputs:
115+
extra_iam_policies:
116+
- "arn:aws:iam::aws:policy/CloudWatchEventsFullAccess"
117+
allowed_k8s_services:
118+
- namespace: "*"
119+
service_name: "*"
70120
```
71121
72122
## Key points

concepts/environment/index.html

Lines changed: 88 additions & 38 deletions
Large diffs are not rendered by default.

concepts/layer.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,20 @@ modules:
4747
- id: postgres
4848
type: aws_postgres
4949
inputs:
50-
database_name: "${{var.db_name}}"
50+
database_name: "${var.db_name}"
5151
- id: s3
5252
type: aws_s3
5353
inputs:
5454
bucket_name: "pltf-app-${layer_name}-${env_name}"
5555
links:
56-
readWrite: adminpltfrole
57-
readWrite: userpltfrole
56+
readWrite:
57+
- adminpltfrole
58+
- userpltfrole
5859
- id: topic
5960
type: aws_sns
6061
inputs:
6162
sqs_subscribers:
62-
- "${{module.notifcationsQueue.queue_arn}}"
63+
- "${module.notifcationsQueue.queue_arn}"
6364
links:
6465
read: adminpltfrole
6566
- id: notifcationsQueue
@@ -78,15 +79,15 @@ modules:
7879
type: aws_iam_role
7980
inputs:
8081
extra_iam_policies:
81-
- "arn:aws:iam::aws:policy/CloudWatchEventsFullAccess"
82+
- "arn:aws:iam::aws:policy/CloudWatchEventsFullAccess"
8283
allowed_k8s_services:
8384
- namespace: "*"
8485
service_name: "*"
8586
- id: userpltfrole
8687
type: aws_iam_role
8788
inputs:
8889
extra_iam_policies:
89-
- "arn:aws:iam::aws:policy/CloudWatchEventsFullAccess"
90+
- "arn:aws:iam::aws:policy/CloudWatchEventsFullAccess"
9091
allowed_k8s_services:
9192
- namespace: "*"
9293
service_name: "*"

concepts/layer/index.html

Lines changed: 40 additions & 39 deletions
Large diffs are not rendered by default.

concepts/stack.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ Embedded stacks can be referenced by name (no path or git URL required):
4444
```yaml
4545
metadata:
4646
stacks:
47-
- example-aws-stack
4847
- example-eks-stack
4948
```
5049

@@ -57,7 +56,6 @@ metadata:
5756

5857
## Embedded stacks
5958
These stacks ship with the CLI and can be referenced by name:
60-
- `example-aws-stack`
6159
- `example-eks-stack`
6260

6361
## Merge behavior

concepts/stack/index.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -863,8 +863,7 @@ <h2 id="referencing-stacks">Referencing stacks</h2>
863863
<p>Embedded stacks can be referenced by name (no path or git URL required):
864864
<div class="language-yaml highlight"><pre><span></span><code><span id="__span-2-1"><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a><span class="nt">metadata</span><span class="p">:</span>
865865
</span><span id="__span-2-2"><a id="__codelineno-2-2" name="__codelineno-2-2" href="#__codelineno-2-2"></a><span class="w"> </span><span class="nt">stacks</span><span class="p">:</span>
866-
</span><span id="__span-2-3"><a id="__codelineno-2-3" name="__codelineno-2-3" href="#__codelineno-2-3"></a><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">example-aws-stack</span>
867-
</span><span id="__span-2-4"><a id="__codelineno-2-4" name="__codelineno-2-4" href="#__codelineno-2-4"></a><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">example-eks-stack</span>
866+
</span><span id="__span-2-3"><a id="__codelineno-2-3" name="__codelineno-2-3" href="#__codelineno-2-3"></a><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">example-eks-stack</span>
868867
</span></code></pre></div></p>
869868
<p>Git refs are supported:
870869
<div class="language-yaml highlight"><pre><span></span><code><span id="__span-3-1"><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a><span class="nt">metadata</span><span class="p">:</span>
@@ -873,7 +872,6 @@ <h2 id="referencing-stacks">Referencing stacks</h2>
873872
</span></code></pre></div></p>
874873
<h2 id="embedded-stacks">Embedded stacks</h2>
875874
<p>These stacks ship with the CLI and can be referenced by name:
876-
- <code>example-aws-stack</code>
877875
- <code>example-eks-stack</code></p>
878876
<h2 id="merge-behavior">Merge behavior</h2>
879877
<ul>

getting-started/aws.md

Lines changed: 84 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,52 +9,107 @@ Follow this walkthrough to go from the checked-in sample (`example/e2e.yaml`) to
99
- `pltf` installed (see [Installation](../installation.md)).
1010
- Dagger installed (only required when building/pushing images via `pltf image ...` or when specs declare Docker images).
1111

12-
## 2) Render the Environment (VPC + EKS + DNS)
12+
## 2) Render the Environment (EKS + shared modules)
1313

14-
The sample `example/e2e.yaml` already wires AWS base, DNS, and EKS modules into the `prod` environment. Copy it to `env.yaml` and adjust variables as needed.
14+
The sample `example/e2e.yaml` already wires the `example-eks-stack` plus shared modules (nodegroups, Postgres, S3, SNS/SQS, IAM roles) into `dev`, `stage`, and `prod`. Copy it to `env.yaml` and adjust variables as needed.
1515

1616
```yaml
1717
apiVersion: platform.io/v1
1818
kind: Environment
19-
19+
gitProvider: github
2020
metadata:
2121
name: example-aws
2222
org: pltf
2323
provider: aws
24-
variables:
25-
base_domain: prod.pltf.internal
26-
cluster_name: pltf-data
24+
labels:
25+
team: platform
26+
cost_center: shared
27+
stacks:
28+
- example-eks-stack
29+
# images:
30+
# - name: platform-tools
31+
# context: .
32+
# dockerfile: Dockerfile
33+
# platforms:
34+
# - linux/amd64
35+
# - linux/arm64
36+
# tags:
37+
# - ghcr.io/example/${layer_name}:${env_name}
38+
# buildArgs:
39+
# ENV: ${env_name}
2740
environments:
41+
dev:
42+
account: "556169302489"
43+
region: ap-northeast-1
44+
stage:
45+
account: "556169302489"
46+
region: ap-northeast-1
2847
prod:
2948
account: "556169302489"
3049
region: ap-northeast-1
50+
variables:
51+
replica_counts: '{"dev":1,"prod":3}'
52+
environment_settings: '{"region":"us-west-2","zones":["us-west-2a","us-west-2b"]}'
3153
modules:
32-
- id: base
33-
type: aws_base
34-
- id: dns
35-
type: aws_dns
36-
inputs:
37-
domain: ${{var.base_domain}}
38-
delegated: false
39-
- id: eks
40-
type: aws_eks
41-
inputs:
42-
cluster_name: "pltf-app-${layer_name}-${env_name}"
43-
k8s_version: 1.33
44-
enable_metrics: false
45-
max_nodes: 15
4654
- id: nodegroup1
47-
type: aws_nodegroup
55+
source: ../modules/aws_nodegroup
4856
inputs:
4957
max_nodes: 15
5058
node_disk_size: 20
59+
- id: postgres
60+
source: https://github.com/yindia/pltf.git//modules/aws_postgres?ref=main
61+
inputs:
62+
database_name: "${layer_name}-${env_name}"
63+
- id: s3
64+
type: aws_s3
65+
inputs:
66+
bucket_name: "pltf-app-${env_name}"
67+
links:
68+
readWrite:
69+
- adminpltfrole
70+
- userpltfrole
71+
- id: topic
72+
type: aws_sns
73+
inputs:
74+
sqs_subscribers:
75+
- "${module.notifcationsQueue.queue_arn}"
76+
links:
77+
read: adminpltfrole
78+
- id: notifcationsQueue
79+
type: aws_sqs
80+
inputs:
81+
fifo: false
82+
links:
83+
readWrite: adminpltfrole
84+
- id: schedulesQueue
85+
type: aws_sqs
86+
inputs:
87+
fifo: false
88+
links:
89+
readWrite: adminpltfrole
90+
- id: adminpltfrole
91+
type: aws_iam_role
92+
inputs:
93+
extra_iam_policies:
94+
- "arn:aws:iam::aws:policy/CloudWatchEventsFullAccess"
95+
allowed_k8s_services:
96+
- namespace: "*"
97+
service_name: "*"
98+
- id: userpltfrole
99+
type: aws_iam_role
100+
inputs:
101+
extra_iam_policies:
102+
- "arn:aws:iam::aws:policy/CloudWatchEventsFullAccess"
103+
allowed_k8s_services:
104+
- namespace: "*"
105+
service_name: "*"
51106
```
52107
53108
That config boots:
54109
55-
- A VPC/subnets/security groups via `aws_base`.
56-
- A DNS zone and records via `aws_dns`.
57-
- An EKS control plane plus one nodegroup (`aws_eks`, `aws_nodegroup`).
110+
- A VPC and EKS control plane via `example-eks-stack` (`aws_base`, `aws_eks`).
111+
- A managed nodegroup, Postgres, and S3 bucket in the environment.
112+
- SNS/SQS queues and IAM roles wired via `links`.
58113

59114
Now run:
60115

@@ -88,19 +143,20 @@ modules:
88143
- id: postgres
89144
type: aws_postgres
90145
inputs:
91-
database_name: "${{var.db_name}}"
146+
database_name: "${var.db_name}"
92147
- id: s3
93148
type: aws_s3
94149
inputs:
95150
bucket_name: "pltf-app-${layer_name}-${env_name}"
96151
links:
97-
readWrite: adminpltfrole
98-
readWrite: userpltfrole
152+
readWrite:
153+
- adminpltfrole
154+
- userpltfrole
99155
- id: topic
100156
type: aws_sns
101157
inputs:
102158
sqs_subscribers:
103-
- "${{module.notifcationsQueue.queue_arn}}"
159+
- "${module.notifcationsQueue.queue_arn}"
104160
links:
105161
read: adminpltfrole
106162
- id: notifcationsQueue

0 commit comments

Comments
 (0)