You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update the image tag in `infra/eks/envs/dev.tfvars`
34
34
35
35
36
-
## 3 · Deploy with Terraform from directory infra/eks
36
+
## 3 · Deploy with Terraform from directory infra/eks/
37
37
38
38
```bash
39
39
AWS_PROFILE=node-app-terraform-dev terraform plan -var-file=../envs/dev.tfvars
@@ -66,8 +66,47 @@ Lookup for url for the exposed k8s Service for ingress-nginx controller
66
66
```bash
67
67
kubectl -n ingress-nginx get svc
68
68
```
69
+
70
+
71
+
---
72
+
73
+
## GitHub Actions for Terraform CI/CD – EKS Infra
74
+
This GitHub Actions workflow automates the infrastructure provisioning lifecycle for the demo Node.js app using Terraform.
75
+
76
+
### Workflow Triggers
77
+
Pull Requests to main: Run CI checks (format, validate, plan).
78
+
79
+
Push to main: Auto-applies Terraform to deploy infrastructure in dev.
80
+
81
+
### Job: terraform-dev
82
+
- Runs inside the infra/ directory
83
+
84
+
- terraform init: Uses a backend config with an S3 bucket passed as a secret.
85
+
86
+
- On PRs:
87
+
- Checks formatting consistency.
88
+
- Validates Terraform configuration.
89
+
- Creates an execution plan using envs/dev.tfvars
90
+
- Automatically comments the plan and outcomes back to the PR using actions/github-script.
91
+
92
+
- On Plan Failure:
93
+
- Marks the PR check as failed (exit 1).
94
+
95
+
- On Push to Main:
96
+
- Executes terraform apply with dev.tfvars, auto-approving without manual input.
97
+
98
+
### Security and Permissions
99
+
GitHub token permissions are explicitly set to allow reading content and commenting on PRs.
100
+
101
+
### Notes
102
+
Production-related jobs (terraform-prod-ci and terraform-prod-cd) are defined but commented out (Preparation for future)
103
+
The workflow is scoped to infrastructure compute resource only deployments, not application code or Docker builds.
104
+
105
+
---
106
+
69
107
---
70
108
109
+
71
110
# Amazon ECS Infrastructure Provisioning using Terraform
72
111
73
112
*(Please note, the PR trigger for automatically deploying changes to ECS (Infra resources) has been commented out (Disabled). This was introduced while I am working on GitHub CICD automation for deploying infra resources for AWS EKS. See above )*
0 commit comments