Skip to content

Commit 7c25625

Browse files
authored
fixed syntax error at container.tf
1 parent 2f6fd00 commit 7c25625

File tree

1 file changed

+10
-11
lines changed
  • adminforth/documentation/blog/2025-11-04-k3s-ec2-deployment

1 file changed

+10
-11
lines changed

adminforth/documentation/blog/2025-11-04-k3s-ec2-deployment/index.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ resource "aws_route_table_association" "public_b_assoc" {
356356
}
357357
358358
resource "aws_security_group" "app_sg" {
359-
name = "app-sg-k3s"
359+
name = "${local.app_name}-SecurityGroup"
360360
vpc_id = aws_vpc.main.id
361361
362362
dynamic "ingress" {
@@ -378,8 +378,8 @@ resource "aws_security_group" "app_sg" {
378378
}
379379
}
380380
381-
resource "aws_iam_role" "k3s_node_role" {
382-
name = "k3s-node-role"
381+
resource "aws_iam_role" "node_role" {
382+
name = "${local.app_name}node-role"
383383
assume_role_policy = jsonencode({
384384
Version = "2012-10-17"
385385
Statement = [{
@@ -392,17 +392,17 @@ resource "aws_iam_role" "k3s_node_role" {
392392
393393
resource "aws_iam_role_policy_attachment" "ecr_read_only_attach" {
394394
policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
395-
role = aws_iam_role.k3s_node_role.name
395+
role = aws_iam_role.node_role.name
396396
}
397397
398398
resource "aws_iam_role_policy_attachment" "ssm_core_policy" {
399399
policy_arn = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
400-
role = aws_iam_role.k3s_node_role.name
400+
role = aws_iam_role.node_role.name
401401
}
402402
403-
resource "aws_iam_instance_profile" "k3s_instance_profile" {
404-
name = "k3s-instance-profile"
405-
role = aws_iam_role.k3s_node_role.name
403+
resource "aws_iam_instance_profile" "instance_profile" {
404+
name = "${local.app_name}-instance-profile"
405+
role = aws_iam_role.node_role.name
406406
}
407407
```
408408

@@ -445,7 +445,7 @@ you need to create a file `Chart.yaml` in it
445445

446446
```yaml title="deploy/helm/helm_charts/Chart.yaml"
447447
apiVersion: v2
448-
name: myadmin # <-- replace with the name of your application
448+
name: myadmin
449449
description: Helm chart for myadmin app
450450
version: 0.1.0
451451
appVersion: "1.0.0"
@@ -454,7 +454,7 @@ appVersion: "1.0.0"
454454
And `values.yaml`
455455

456456
```yaml title="deploy/helm/helm_charts/values.yaml"
457-
appName: myadmin # <-- replace with the name of your application
457+
appName: myadmin
458458
containerPort: 3500
459459
servicePort: 80
460460
adminSecret: "your_secret"
@@ -528,7 +528,6 @@ spec:
528528
ports:
529529
- port: {{ .Values.servicePort }}
530530
targetPort: {{ .Values.containerPort }}
531-
532531
```
533532

534533
The comments in the `values.yaml` and `Chart.yaml` files indicate the names of the variables that need to be replaced. They must correspond to the variables in Ansible, which will be discussed later.

0 commit comments

Comments
 (0)