<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jeeva</title>
    <description>The latest articles on DEV Community by Jeeva (@jeeva_5c84a254e90842940dd).</description>
    <link>https://dev.to/jeeva_5c84a254e90842940dd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3397840%2F73b1fdf4-fb63-4df0-82f6-a2272e76ef7c.jpg</url>
      <title>DEV Community: Jeeva</title>
      <link>https://dev.to/jeeva_5c84a254e90842940dd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jeeva_5c84a254e90842940dd"/>
    <language>en</language>
    <item>
      <title>Day 30 – Terraform Drift Detection &amp; Auto-Remediation with GitHub Actions 🚀</title>
      <dc:creator>Jeeva</dc:creator>
      <pubDate>Mon, 16 Feb 2026 17:23:42 +0000</pubDate>
      <link>https://dev.to/jeeva_5c84a254e90842940dd/day-30-terraform-drift-detection-auto-remediation-with-github-actions-316h</link>
      <guid>https://dev.to/jeeva_5c84a254e90842940dd/day-30-terraform-drift-detection-auto-remediation-with-github-actions-316h</guid>
      <description>&lt;p&gt;&lt;strong&gt;🎯 Objective&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Build a fully automated system that:&lt;/li&gt;
&lt;li&gt;Provisions infrastructure using Terraform&lt;/li&gt;
&lt;li&gt;Detects unauthorized/manual infrastructure changes (drift)&lt;/li&gt;
&lt;li&gt;Automatically remediates drift&lt;/li&gt;
&lt;li&gt;Sends Slack notifications&lt;/li&gt;
&lt;li&gt;Manages GitHub issues for audit tracking&lt;/li&gt;
&lt;li&gt;Supports dev and prod environments
All using GitHub Actions as the automation engine&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;🏗 Project Architecture&lt;/strong&gt;&lt;br&gt;
The infrastructure includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;VPC with public &amp;amp; private subnets&lt;/li&gt;
&lt;li&gt;NAT Gateway for outbound internet&lt;/li&gt;
&lt;li&gt;Autoscaling group across availability zones&lt;/li&gt;
&lt;li&gt;Separate backend state for dev &amp;amp; prod (S3 + DynamoDB locking)&lt;/li&gt;
&lt;li&gt;GitHub repository as the single source of truth&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Terraform code is stored in GitHub, and GitHub Actions workflows automate:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Provisioning&lt;/li&gt;
&lt;li&gt;Drift detection&lt;/li&gt;
&lt;li&gt;Destruction&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;🔄 How Drift Detection Works&lt;/strong&gt;&lt;br&gt;
Terraform’s plan command supports detailed exit codes:&lt;br&gt;
0 → No changes&lt;br&gt;
2 → Drift detected&lt;br&gt;
1 → Error&lt;/p&gt;

&lt;p&gt;The drift detection workflow runs:&lt;br&gt;
terraform plan -detailed-exitcode&lt;/p&gt;

&lt;p&gt;If exit code 2 is returned:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Drift is confirmed&lt;/li&gt;
&lt;li&gt;terraform apply -auto-approve runs automatically&lt;/li&gt;
&lt;li&gt;Infrastructure is restored to the desired state&lt;/li&gt;
&lt;li&gt;Slack notification is sent&lt;/li&gt;
&lt;li&gt;GitHub issue is updated/closed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This enforces:&lt;br&gt;
Terraform code = Single Source of Truth&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧪 Live Drift Testing&lt;/strong&gt;&lt;br&gt;
A manual change was made directly in AWS (modifying resource tags).&lt;/p&gt;

&lt;p&gt;Result:&lt;br&gt;
GitHub Actions detected drift&lt;br&gt;
Terraform re-applied correct configuration&lt;br&gt;
Tags reverted automatically&lt;br&gt;
Slack notification confirmed remediation&lt;br&gt;
GitHub issue lifecycle updated&lt;/p&gt;

&lt;p&gt;This demonstrated real production-level drift governance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔐 Security &amp;amp; Best Practices Implemented&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS credentials stored in GitHub Secrets&lt;/li&gt;
&lt;li&gt;Slack webhook stored securely&lt;/li&gt;
&lt;li&gt;Separate backend state for dev &amp;amp; prod&lt;/li&gt;
&lt;li&gt;DynamoDB locking to prevent concurrent state corruption&lt;/li&gt;
&lt;li&gt;Scheduled Cron-based drift monitoring&lt;/li&gt;
&lt;li&gt;Manual approvals for production workflows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;📌 Key Takeaways&lt;/strong&gt;&lt;br&gt;
✔ Drift detection prevents configuration inconsistencies&lt;br&gt;
✔ GitHub Actions can fully automate infrastructure lifecycle&lt;br&gt;
✔ Terraform exit codes enable intelligent CI/CD logic&lt;br&gt;
✔ Slack integration improves operational visibility&lt;br&gt;
✔ GitHub Issues provide audit traceability&lt;br&gt;
✔ IaC must always be treated as the single source of truth&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>github</category>
      <category>terraform</category>
    </item>
    <item>
      <title>Day 29 – End-to-End GitOps with Terraform and ArgoCD on EKS 🚀</title>
      <dc:creator>Jeeva</dc:creator>
      <pubDate>Mon, 16 Feb 2026 17:14:35 +0000</pubDate>
      <link>https://dev.to/jeeva_5c84a254e90842940dd/day-29-end-to-end-gitops-with-terraform-and-argocd-on-eks-1464</link>
      <guid>https://dev.to/jeeva_5c84a254e90842940dd/day-29-end-to-end-gitops-with-terraform-and-argocd-on-eks-1464</guid>
      <description>&lt;p&gt;&lt;strong&gt;🎯 Objective&lt;/strong&gt;&lt;br&gt;
Deploy a full 3-tier application (frontend, backend, database) on an Amazon EKS cluster using:&lt;br&gt;
Terraform (for infrastructure provisioning)&lt;br&gt;
Public Terraform modules (for EKS &amp;amp; networking)&lt;br&gt;
ArgoCD (for GitOps-based application delivery)&lt;br&gt;
GitHub repository as the single source of truth&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🏗 Architecture Overview&lt;/strong&gt;&lt;br&gt;
The project architecture includes:&lt;br&gt;
✅ VPC &amp;amp; networking components&lt;br&gt;
✅ Amazon EKS cluster &amp;amp; worker nodes&lt;br&gt;
✅ Kubernetes namespace for the application&lt;br&gt;
✅ Frontend, backend &amp;amp; database deployments&lt;br&gt;
✅ Persistent storage using Amazon EBS&lt;br&gt;
✅ ArgoCD for continuous reconciliation&lt;br&gt;
✅ LoadBalancer service for external access&lt;br&gt;
All Kubernetes manifests are stored in GitHub. ArgoCD continuously monitors the repository and ensures the cluster state matches the desired state defined in Git.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔄 GitOps &amp;amp; Drift Detection in Action&lt;/strong&gt;&lt;br&gt;
One of the most powerful demonstrations in this session was drift detection.&lt;br&gt;
Example scenario:&lt;br&gt;
Manually change the number of replicas in Kubernetes.&lt;br&gt;
ArgoCD immediately detects the deviation.&lt;br&gt;
It automatically reverts the cluster back to the defined state in Git.&lt;/p&gt;

&lt;p&gt;This proves a critical GitOps principle:&lt;br&gt;
The Git repository is the source of truth.&lt;br&gt;
Any unauthorized change is automatically corrected.&lt;br&gt;
This eliminates configuration drift and improves production reliability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🛠 Terraform Providers Used&lt;/strong&gt;&lt;br&gt;
Multiple Terraform providers were leveraged:&lt;br&gt;
&lt;em&gt;AWS provider – For VPC, EKS, nodes, IAM roles, EBS&lt;br&gt;
Kubernetes provider – For deploying K8s resources&lt;br&gt;
kubectl provider – For applying manifests like ArgoCD&lt;/em&gt;&lt;br&gt;
Using public Terraform modules accelerated infrastructure setup while demonstrating how reusable modules simplify production deployments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🚀 Deployment Workflow&lt;/strong&gt;&lt;br&gt;
terraform init&lt;br&gt;
terraform plan&lt;br&gt;
terraform apply&lt;br&gt;
EKS cluster provisioning&lt;br&gt;
ArgoCD installation via kubectl&lt;br&gt;
Application deployment via GitHub repo&lt;br&gt;
Automatic synchronization &amp;amp; monitoring&lt;/p&gt;

&lt;p&gt;Persistent storage was configured using Amazon EBS volumes, ensuring stateful components like the database retain data across pod restarts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔐 Best Practice Discussion&lt;/strong&gt;&lt;br&gt;
Although public Terraform modules were used for speed, an important discussion highlighted:&lt;br&gt;
Public modules are convenient.&lt;br&gt;
Enterprises should carefully review them.&lt;br&gt;
Security, compliance, and internal standards often require custom modules.&lt;/p&gt;

&lt;p&gt;This balance between speed and control is critical in real-world environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Key Takeaways&lt;/strong&gt;&lt;br&gt;
✔ Infrastructure and applications can be fully automated end-to-end&lt;br&gt;
✔ GitOps eliminates manual deployment risks&lt;br&gt;
✔ ArgoCD provides automatic drift correction&lt;br&gt;
✔ EKS + Terraform enables scalable Kubernetes infrastructure&lt;br&gt;
✔ Persistent storage is essential for stateful applications&lt;br&gt;
✔ Public modules accelerate setup but must be reviewed in enterprise setups&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>kubernetes</category>
      <category>terraform</category>
    </item>
    <item>
      <title>🚀 Day 28 – Three-Tier Highly Available AWS Architecture with Terraform</title>
      <dc:creator>Jeeva</dc:creator>
      <pubDate>Mon, 16 Feb 2026 15:25:27 +0000</pubDate>
      <link>https://dev.to/jeeva_5c84a254e90842940dd/day-28-three-tier-highly-available-aws-architecture-with-terraform-2o3n</link>
      <guid>https://dev.to/jeeva_5c84a254e90842940dd/day-28-three-tier-highly-available-aws-architecture-with-terraform-2o3n</guid>
      <description>&lt;p&gt;&lt;strong&gt;🏗 Architecture Overview&lt;/strong&gt;&lt;br&gt;
The project implements a classic three-tier architecture:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Presentation Layer (Frontend)&lt;/em&gt;&lt;br&gt;
EC2 instances in private subnets&lt;br&gt;
Behind an Internet-facing Application Load Balancer&lt;br&gt;
Dockerized frontend container&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Logic Layer (Backend)&lt;/em&gt;&lt;br&gt;
EC2 instances in private subnets&lt;br&gt;
Behind an Internal Load Balancer&lt;br&gt;
Dockerized backend container&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Data Layer (Database)&lt;/em&gt;&lt;br&gt;
Amazon RDS (Multi-AZ enabled)&lt;br&gt;
Private subnet deployment&lt;br&gt;
Credentials stored securely in AWS Secrets Manager&lt;/p&gt;

&lt;p&gt;Additional components:&lt;br&gt;
Bastion Host for secure SSH access&lt;br&gt;
NAT Gateway for outbound internet from private subnets&lt;br&gt;
Auto Scaling Groups across multiple Availability Zones&lt;br&gt;
Strict Security Groups &amp;amp; IAM Roles&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🌐 High-Level Traffic Flow&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Internet&lt;br&gt;
   ↓&lt;br&gt;
Internet Gateway&lt;br&gt;
   ↓&lt;br&gt;
External ALB (Port 80)&lt;br&gt;
   ↓&lt;br&gt;
Frontend EC2 (Docker container - Port 3000)&lt;br&gt;
   ↓&lt;br&gt;
Internal ALB&lt;br&gt;
   ↓&lt;br&gt;
Backend EC2 (Docker container - Port 8080)&lt;br&gt;
   ↓&lt;br&gt;
RDS (Multi-AZ)&lt;/p&gt;

&lt;p&gt;This ensures:&lt;br&gt;
High availability&lt;br&gt;
Fault tolerance&lt;br&gt;
Secure network segmentation&lt;br&gt;
Scalability under load&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔐 Security Architecture&lt;/strong&gt;&lt;br&gt;
Security was a major focus in this implementation.&lt;/p&gt;

&lt;p&gt;🔹 Private Subnets&lt;br&gt;
Frontend, Backend, and RDS are not publicly accessible.&lt;/p&gt;

&lt;p&gt;🔹 Bastion Host&lt;br&gt;
Used as a secure jump server to SSH into private instances.&lt;/p&gt;

&lt;p&gt;🔹 NAT Gateway&lt;br&gt;
Allows private instances to:&lt;br&gt;
Pull Docker images&lt;br&gt;
Install updates&lt;br&gt;
Access AWS services&lt;br&gt;
Without exposing them to inbound traffic.&lt;/p&gt;

&lt;p&gt;🔹 Security Groups&lt;br&gt;
ALB allows HTTP from internet&lt;br&gt;
Frontend allows traffic only from ALB&lt;br&gt;
Backend allows traffic only from internal ALB&lt;br&gt;
Database allows traffic only from backend SG&lt;/p&gt;

&lt;p&gt;🔹 IAM Roles&lt;br&gt;
EC2 instances have least-privilege access for:&lt;br&gt;
CloudWatch&lt;br&gt;
Session Manager&lt;br&gt;
Secrets Manager&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📦 Docker Deployment on EC2&lt;/strong&gt;&lt;br&gt;
Frontend and Backend applications are:&lt;br&gt;
Built as Docker images&lt;br&gt;
Pushed to Docker Hub&lt;br&gt;
Pulled automatically in EC2 via user-data scripts&lt;br&gt;
Started during instance launch&lt;/p&gt;

&lt;p&gt;This ensures:&lt;br&gt;
Consistent deployments&lt;br&gt;
Easy scaling via ASG&lt;br&gt;
Reproducible environments&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📈 Auto Scaling &amp;amp; Load Balancing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;External ALB&lt;/em&gt;&lt;br&gt;
Internet-facing&lt;br&gt;
Health checks on frontend instances&lt;br&gt;
Routes traffic dynamically&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Internal ALB&lt;/em&gt;&lt;br&gt;
Handles communication between frontend and backend&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Auto Scaling Groups&lt;/em&gt;&lt;br&gt;
Multi-AZ deployment&lt;br&gt;
Configured min, max, desired capacity&lt;br&gt;
Scales based on CPU utilization&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🗄 Database Configuration&lt;/strong&gt;&lt;br&gt;
RDS setup includes:&lt;br&gt;
Multi-AZ deployment&lt;br&gt;
Custom DB subnet group&lt;br&gt;
Parameter group configuration&lt;br&gt;
Engine version specification&lt;br&gt;
Secrets stored in AWS Secrets Manager&lt;/p&gt;

&lt;p&gt;During provisioning, an issue occurred due to PostgreSQL parameter incompatibility, which was resolved by adjusting the engine version — a real-world debugging scenario.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>aws</category>
      <category>devops</category>
      <category>terraform</category>
    </item>
    <item>
      <title>🚀 Terraform Day 27: Automating Infrastructure with GitHub Actions (CI/CD)</title>
      <dc:creator>Jeeva</dc:creator>
      <pubDate>Wed, 31 Dec 2025 14:36:54 +0000</pubDate>
      <link>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-27-automating-infrastructure-with-github-actions-cicd-4o44</link>
      <guid>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-27-automating-infrastructure-with-github-actions-cicd-4o44</guid>
      <description>&lt;p&gt;&lt;strong&gt;🧱 Infrastructure Context&lt;/strong&gt;&lt;br&gt;
The pipeline manages a production-style AWS architecture:&lt;br&gt;
&lt;em&gt;VPC with public and private subnets&lt;br&gt;
Application Load Balancer&lt;br&gt;
Auto Scaling Groups&lt;br&gt;
NAT Gateways&lt;br&gt;
Multi-AZ deployment&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The focus is not on building the infrastructure itself —&lt;br&gt;
the focus is on automating its lifecycle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔄 CI/CD Pipeline Architecture&lt;/strong&gt;&lt;br&gt;
Pipeline Philosophy&lt;br&gt;
Terraform execution is split into clear stages:&lt;br&gt;
Plan&lt;br&gt;
Apply&lt;br&gt;
Destroy&lt;br&gt;
Each stage is automated, controlled, and auditable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧪 Stage 1: Terraform Plan (Pull Request)&lt;/strong&gt;&lt;br&gt;
Triggered when a pull request is created.&lt;br&gt;
What Happens&lt;br&gt;
Terraform initializes with remote backend&lt;br&gt;
terraform validate run&lt;br&gt;
TFLint checks Terraform best practices&lt;br&gt;
Trivy scans Terraform code for security risks&lt;br&gt;
terraform plan executes&lt;br&gt;
Plan output is stored as a pipeline artifact&lt;/p&gt;

&lt;p&gt;Key Rule&lt;br&gt;
❌ No infrastructure changes happen here&lt;/p&gt;

&lt;p&gt;This stage exists purely for:&lt;br&gt;
Review&lt;br&gt;
Validation&lt;br&gt;
Security feedback&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🚀 Stage 2: Terraform Apply (Merge)&lt;/strong&gt;&lt;br&gt;
Triggered when code is merged.&lt;/p&gt;

&lt;p&gt;Workspace Selection&lt;br&gt;
Terraform workspace is selected automatically based on branch:&lt;br&gt;
Branch  Workspace&lt;br&gt;
dev dev&lt;br&gt;
test    test&lt;br&gt;
main    prod&lt;/p&gt;

&lt;p&gt;This ensures:&lt;br&gt;
State isolation&lt;br&gt;
Environment separation&lt;br&gt;
Zero cross-environment interference&lt;br&gt;
Apply Behavior&lt;br&gt;
Terraform apply uses the saved plan&lt;br&gt;
Dev/Test can auto-apply&lt;br&gt;
Production requires manual approval&lt;br&gt;
This enforces change control.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔐 Production Safety Controls&lt;/strong&gt;&lt;br&gt;
Production deployments include:&lt;br&gt;
Environment-level protection rules&lt;br&gt;
Manual approval gates&lt;br&gt;
Explicit confirmation before apply&lt;br&gt;
Audit trail of who approved what&lt;br&gt;
This mirrors real enterprise governance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔍 Security Scanning with Tri&lt;/strong&gt;vy&lt;br&gt;
Security scanning is built directly into CI.&lt;br&gt;
Trivy detects issues such as:&lt;br&gt;
Open SSH access (0.0.0.0/0)&lt;br&gt;
Public IP exposure&lt;br&gt;
Missing HTTPS&lt;br&gt;
Weak networking rules&lt;/p&gt;

&lt;p&gt;Important Outcome&lt;br&gt;
Security issues fail the pipeline early, before deployment.&lt;br&gt;
Security is shifted left, not added later&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧨 Terraform Destroy Pipeline&lt;/strong&gt;&lt;br&gt;
Infrastructure lifecycle is incomplete without destruction.&lt;br&gt;
Day 27 includes a dedicated destroy workflow:&lt;br&gt;
Manually triggered&lt;br&gt;
Environment selection required&lt;br&gt;
Approval enforced&lt;br&gt;
Fully automated teardown&lt;/p&gt;

&lt;p&gt;Used for:&lt;br&gt;
Cost control&lt;br&gt;
Testing lifecycle maturity&lt;br&gt;
Safe cleanup&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔑 Secrets &amp;amp; State Management&lt;/strong&gt;&lt;br&gt;
Secrets&lt;br&gt;
AWS credentials stored in GitHub Secrets&lt;br&gt;
Injected securely at runtime&lt;br&gt;
Never committed to code&lt;/p&gt;

&lt;p&gt;State&lt;br&gt;
Terraform state stored in S3&lt;br&gt;
DynamoDB used for state locking&lt;br&gt;
No local state files&lt;br&gt;
This enables team collaboration without conflicts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🛠 Tools Used&lt;/strong&gt;&lt;br&gt;
Terraform&lt;br&gt;
GitHub Actions&lt;br&gt;
AWS S3 (remote state)&lt;br&gt;
DynamoDB (state locking)&lt;br&gt;
TFLint&lt;br&gt;
Trivy&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🏁 Conclusion&lt;/strong&gt;&lt;br&gt;
Day 27 demonstrates end-to-end Terraform automation using GitHub Actions.&lt;br&gt;
This is not a demo pipeline.&lt;br&gt;
This is a real, production-ready infrastructure workflow.&lt;/p&gt;

&lt;p&gt;Terraform becomes:&lt;br&gt;
&lt;em&gt;Predictable&lt;br&gt;
Secure&lt;br&gt;
Auditable&lt;br&gt;
Scalable&lt;/em&gt;&lt;br&gt;
This is how modern DevOps teams manage cloud infrastructure.&lt;/p&gt;

</description>
      <category>githubactions</category>
      <category>cicd</category>
      <category>devops</category>
      <category>terraform</category>
    </item>
    <item>
      <title>🚀 Terraform Day 26: HashiCorp Cloud Platform (Terraform Cloud)</title>
      <dc:creator>Jeeva</dc:creator>
      <pubDate>Wed, 31 Dec 2025 02:53:06 +0000</pubDate>
      <link>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-26-hashicorp-cloud-platform-terraform-cloud-1c3</link>
      <guid>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-26-hashicorp-cloud-platform-terraform-cloud-1c3</guid>
      <description>&lt;p&gt;Day 26 focuses on HashiCorp Cloud Platform (HCP) / Terraform Cloud and why it is essential for managing Terraform at scale in real-world environments.&lt;/p&gt;

&lt;p&gt;Running Terraform only from the CLI creates challenges around state management, secrets, automation, governance, and collaboration.&lt;br&gt;
This session demonstrates how Terraform Cloud solves those problems with a managed, secure, and automated workflow.&lt;/p&gt;

&lt;p&gt;This is how Terraform is used in production teams, not just locally.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧠 Why Terraform Cloud Is Needed&lt;/strong&gt;&lt;br&gt;
Problems with CLI-only Terraform:&lt;br&gt;
❌ Secrets stored locally or in environment variables&lt;br&gt;
❌ Manual terraform plan / apply&lt;br&gt;
❌ No built-in CI/CD&lt;br&gt;
❌ No shared state or team visibility&lt;br&gt;
❌ Hard to manage multiple environments&lt;br&gt;
❌ No approval workflows for production&lt;/p&gt;

&lt;p&gt;Terraform Cloud fixes this by providing:&lt;br&gt;
✅ Encrypted remote state&lt;br&gt;
✅ Secure variable &amp;amp; secret storage&lt;br&gt;
✅ GitHub/GitLab integration&lt;br&gt;
✅ Automated runs on code changes&lt;br&gt;
✅ Manual approval gates&lt;br&gt;
✅ Centralized logs &amp;amp; auditability&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🏗 Terraform Cloud Architecture&lt;/strong&gt;&lt;br&gt;
Hierarchy used in Terraform Cloud:&lt;/p&gt;

&lt;p&gt;Organization&lt;br&gt;
 └── Projects&lt;br&gt;
      └── Workspaces&lt;br&gt;
           └── Terraform Code&lt;/p&gt;

&lt;p&gt;Organization → Company or personal account&lt;br&gt;
Project → Logical grouping (App, Team, Cloud, Business Unit)&lt;br&gt;
Workspace → Actual Terraform execution unit&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔁 Supported Workflows&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;1️⃣ Version Control Workflow (Recommended)&lt;/em&gt;&lt;br&gt;
Terraform runs automatically when code is pushed&lt;br&gt;
Plan and apply executed in Terraform Cloud&lt;br&gt;
Full GitOps-style workflow&lt;/p&gt;

&lt;p&gt;Best for:&lt;br&gt;
Teams&lt;br&gt;
Production environments&lt;br&gt;
Audited infrastructure&lt;/p&gt;

&lt;p&gt;&lt;em&gt;2️⃣ CLI-Driven Workflow&lt;/em&gt;&lt;br&gt;
Run Terraform locally&lt;br&gt;
State and execution happen in Terraform Cloud&lt;br&gt;
Logs visible in UI&lt;/p&gt;

&lt;p&gt;Best for:&lt;br&gt;
Local development&lt;br&gt;
Migration from CLI to cloud workflows&lt;/p&gt;

&lt;p&gt;&lt;em&gt;3️⃣ API-Driven Workflow&lt;/em&gt;&lt;br&gt;
Trigger Terraform runs via APIs&lt;br&gt;
Used in advanced automation pipelines&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔐 Secure Credential Management&lt;/strong&gt;&lt;br&gt;
AWS keys stored as encrypted workspace variables&lt;br&gt;
No credentials inside .tf files&lt;br&gt;
No secrets in GitHub repositories&lt;br&gt;
Environment variables handled securely by Terraform Cloud&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;⚙️ Manual Approval vs Auto Apply&lt;/strong&gt;&lt;br&gt;
Auto Apply&lt;br&gt;
Useful for dev/test&lt;br&gt;
Faster feedback loops&lt;br&gt;
Manual Approval&lt;br&gt;
Mandatory for production&lt;br&gt;
Prevents accidental destruction&lt;br&gt;
Strong governance control&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧪 Hands-On Demonstrations&lt;/strong&gt;&lt;br&gt;
✔ Creating Organization, Projects, and Workspaces&lt;br&gt;
✔ Running Terraform via GitHub commits&lt;br&gt;
✔ Handling missing AWS credentials in Terraform Cloud&lt;br&gt;
✔ Switching between auto-apply and manual approval&lt;br&gt;
✔ CLI integration using terraform login&lt;br&gt;
✔ Resolving Terraform version mismatches&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🏁 Conclusion&lt;/strong&gt;&lt;br&gt;
Day 26 marks the transition from individual Terraform usage to enterprise-grade Terraform workflows.&lt;/p&gt;

&lt;p&gt;Terraform Cloud is not optional at scale — it is a requirement for:&lt;br&gt;
Security&lt;br&gt;
Automation&lt;br&gt;
Collaboration&lt;br&gt;
Governance&lt;br&gt;
Reliability&lt;/p&gt;

&lt;p&gt;This is how Terraform is actually used in real production environments.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>automation</category>
      <category>cloud</category>
      <category>terraform</category>
    </item>
    <item>
      <title>🚀 Terraform Day 25: Importing Existing AWS Resources into Terraform State</title>
      <dc:creator>Jeeva</dc:creator>
      <pubDate>Tue, 30 Dec 2025 17:58:02 +0000</pubDate>
      <link>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-25-importing-existing-aws-resources-into-terraform-state-29ge</link>
      <guid>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-25-importing-existing-aws-resources-into-terraform-state-29ge</guid>
      <description>&lt;p&gt;&lt;strong&gt;🧠 The Core Problem Terraform Import Solves&lt;/strong&gt;&lt;br&gt;
In many environments:&lt;br&gt;
AWS resources already exist&lt;br&gt;
They were created manually (console / CLI)&lt;br&gt;
Terraform has no knowledge of them&lt;br&gt;
Terraform tries to recreate them → ❌ conflict&lt;/p&gt;

&lt;p&gt;Example error:&lt;br&gt;
Error: resource already exists&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Why this happens:&lt;br&gt;
Terraform only tracks what exists inside its state file&lt;br&gt;
If a resource is not in state, Terraform assumes it does not exist&lt;/em&gt;&lt;br&gt;
Terraform import fixes this by syncing reality into state.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧱 Understanding Terraform State&lt;/strong&gt;&lt;br&gt;
terraform.tfstate is Terraform’s source of truth&lt;/p&gt;

&lt;p&gt;It stores:&lt;br&gt;
Resource IDs&lt;br&gt;
Attributes&lt;br&gt;
Metadata&lt;/p&gt;

&lt;p&gt;Terraform uses state instead of calling AWS APIs repeatedly&lt;/p&gt;

&lt;p&gt;If state is lost:&lt;br&gt;
Terraform forgets everything&lt;br&gt;
Import can rebuild state safely&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔄 Terraform Import Workflow&lt;/strong&gt;&lt;br&gt;
Resource already exists in AWS&lt;br&gt;
Write a minimal Terraform resource block&lt;br&gt;
Run terraform import&lt;br&gt;
Terraform maps the live resource → state file&lt;br&gt;
Terraform now manages the resource&lt;br&gt;
Import updates state only, not the live resource.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Terraform Import Commands Used&lt;/strong&gt;&lt;br&gt;
Import Security Group&lt;br&gt;
terraform import aws_security_group.web_sg sg-xxxxxxxx&lt;/p&gt;

&lt;p&gt;Import EC2 Instance&lt;br&gt;
terraform import aws_instance.web ec2-xxxxxxxx&lt;/p&gt;

&lt;p&gt;Verify Imported State&lt;br&gt;
terraform state list&lt;br&gt;
terraform state show aws_security_group.web_sg&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔍 Terraform Import vs Other Tools&lt;/strong&gt;&lt;br&gt;
Terraform Import (Recommended)&lt;br&gt;
✅ Officially supported&lt;br&gt;
✅ Covers all AWS resources&lt;br&gt;
✅ Safe and predictable&lt;br&gt;
❌ Requires manual config writing&lt;/p&gt;

&lt;p&gt;Terraformer / AWS2TF&lt;br&gt;
✅ Auto-generate config&lt;br&gt;
❌ Limited resource coverage&lt;br&gt;
❌ Community-maintained&lt;br&gt;
❌ Often outdated or buggy&lt;/p&gt;

&lt;p&gt;Production best practice:&lt;br&gt;
Use Terraform import for accuracy and control.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🏁 Conclusion&lt;/strong&gt;&lt;br&gt;
Day 25 highlights a non-negotiable Terraform skill.&lt;/p&gt;

&lt;p&gt;Terraform import bridges the gap between:&lt;br&gt;
Manual infrastructure&lt;br&gt;
Fully automated Infrastructure as Code&lt;/p&gt;

&lt;p&gt;Without import:&lt;br&gt;
Terraform fails&lt;br&gt;
Conflicts occur&lt;br&gt;
Automation breaks&lt;/p&gt;

&lt;p&gt;With import:&lt;br&gt;
Legacy infrastructure becomes manageable&lt;br&gt;
Terraform regains control&lt;br&gt;
IaC adoption becomes possible&lt;/p&gt;

&lt;p&gt;This is how Terraform is used in real AWS environments, not just greenfield projects.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>devops</category>
      <category>aws</category>
      <category>terraform</category>
    </item>
    <item>
      <title>🚀 Terraform Day 24: Highly Available Web Application on AWS (ALB + ASG + Private Subnets)</title>
      <dc:creator>Jeeva</dc:creator>
      <pubDate>Tue, 30 Dec 2025 02:24:43 +0000</pubDate>
      <link>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-24-highly-available-web-application-on-aws-alb-asg-private-subnets-2n8p</link>
      <guid>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-24-highly-available-web-application-on-aws-alb-asg-private-subnets-2n8p</guid>
      <description>&lt;p&gt;&lt;strong&gt;🧱 Architecture Overview&lt;/strong&gt;&lt;br&gt;
🌐 Networking Layer&lt;br&gt;
Custom VPC&lt;br&gt;
Public subnets (for ALB &amp;amp; NAT Gateway)&lt;br&gt;
Private subnets (for EC2 instances)&lt;br&gt;
Internet Gateway&lt;br&gt;
Route tables for controlled traffic flow&lt;/p&gt;

&lt;p&gt;⚖️ Load Balancing&lt;br&gt;
Application Load Balancer (ALB)&lt;br&gt;
Target groups with health checks&lt;br&gt;
Listener forwarding traffic to healthy EC2 instances&lt;/p&gt;

&lt;p&gt;🔄 Compute &amp;amp; Scaling&lt;br&gt;
Launch Template with:&lt;br&gt;
AMI&lt;br&gt;
Security groups&lt;br&gt;
User data script&lt;br&gt;
Auto Scaling Group:&lt;br&gt;
Min, max, desired capacity&lt;br&gt;
CPU-based scaling policies&lt;br&gt;
Multi-AZ EC2 placement&lt;/p&gt;

&lt;p&gt;🐳 Application Deployment&lt;br&gt;
Django web app&lt;br&gt;
Docker installed via EC2 user data&lt;br&gt;
Container launched automatically at instance startup&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔐 Security Design&lt;/strong&gt;&lt;br&gt;
EC2 instances do not have public IPs&lt;br&gt;
Instances are reachable only via ALB&lt;br&gt;
Private subnets isolate application servers&lt;br&gt;
NAT Gateway allows:&lt;br&gt;
&lt;em&gt;Docker image pulls&lt;br&gt;
OS updates&lt;br&gt;
Outbound internet access only&lt;/em&gt;&lt;br&gt;
This aligns with least-exposure security principles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧪 Testing &amp;amp; Validation&lt;/strong&gt;&lt;br&gt;
✅ High Availability Test&lt;br&gt;
Application remains accessible via ALB&lt;br&gt;
Individual EC2 instance failure does not break the app&lt;br&gt;
Traffic automatically reroutes to healthy instances&lt;/p&gt;

&lt;p&gt;🔄 Autoscaling Test&lt;br&gt;
Load generated using Apache JMeter&lt;br&gt;
CPU-based scaling policies evaluated&lt;br&gt;
Observed that CPU alone may not reflect real traffic load&lt;br&gt;
Highlights need for memory / request-based metrics in production&lt;/p&gt;

&lt;p&gt;🔐 Private Access Test&lt;br&gt;
Direct SSH blocked due to private subnet placement&lt;br&gt;
EC2 Instance Connect Endpoint used for secure access&lt;br&gt;
No public exposure of application servers&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🏁 Conclusion&lt;/strong&gt;&lt;br&gt;
Day 24 demonstrates how real production web platforms are built on AWS.&lt;br&gt;
&lt;em&gt;This is not about launching a single EC2 instance — it’s about:&lt;br&gt;
Availability&lt;br&gt;
Fault tolerance&lt;br&gt;
Security&lt;br&gt;
Scalability&lt;br&gt;
Automation&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;By combining ALB, Auto Scaling Groups, private networking, and Docker, Terraform enables a robust, enterprise-grade hosting solution.&lt;/p&gt;

&lt;p&gt;This project forms a strong foundation for extending into full three-tier architectures with databases, caching, and CI/CD pipelines.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>devops</category>
      <category>aws</category>
      <category>terraform</category>
    </item>
    <item>
      <title>🚀 Terraform Day 23: Production-Grade Monitoring &amp; Observability on AWS (Serverless)</title>
      <dc:creator>Jeeva</dc:creator>
      <pubDate>Mon, 29 Dec 2025 14:15:44 +0000</pubDate>
      <link>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-23-production-grade-monitoring-observability-on-aws-serverless-5096</link>
      <guid>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-23-production-grade-monitoring-observability-on-aws-serverless-5096</guid>
      <description>&lt;p&gt;&lt;strong&gt;🧱 Services Used&lt;/strong&gt;&lt;br&gt;
AWS Lambda – serverless compute&lt;br&gt;
Amazon S3 – source &amp;amp; destination buckets&lt;br&gt;
Amazon CloudWatch&lt;br&gt;
Logs&lt;br&gt;
Metrics&lt;br&gt;
Dashboards&lt;br&gt;
Alarms&lt;br&gt;
Amazon SNS – email notifications&lt;br&gt;
AWS CloudTrail – API activity auditing&lt;br&gt;
Terraform (custom modules) – full automation&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧩 Terraform Architecture (Modular)&lt;/strong&gt;&lt;br&gt;
The project is split into multiple custom Terraform modules:&lt;br&gt;
s3 – secure buckets with encryption &amp;amp; versioning&lt;br&gt;
lambda – function, IAM role, permissions&lt;br&gt;
cloudwatch_logs – log groups &amp;amp; filters&lt;br&gt;
cloudwatch_metrics – custom metrics&lt;br&gt;
cloudwatch_alarms – alert definitions&lt;br&gt;
sns – notification channels&lt;br&gt;
This mirrors real enterprise Terraform layouts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📊 Observability Implementation&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;1️⃣ Logs (CloudWatch Logs)&lt;/em&gt;&lt;br&gt;
Lambda logs are captured and analyzed using log metric filters.&lt;br&gt;
Tracked patterns include:&lt;br&gt;
Processing errors&lt;br&gt;
Invalid file uploads&lt;br&gt;
Large file sizes&lt;br&gt;
Access denied events&lt;br&gt;
Successful executions&lt;/p&gt;

&lt;p&gt;Regex-based filters convert logs into metrics.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;2️⃣ Custom Metrics&lt;/em&gt;&lt;br&gt;
Beyond default Lambda metrics, custom metrics include:&lt;br&gt;
Images processed successfully&lt;br&gt;
Image processing failures&lt;br&gt;
Invalid file types&lt;br&gt;
Processing duration thresholds&lt;br&gt;
File size violations&lt;/p&gt;

&lt;p&gt;These metrics provide application-level visibility, not just infrastructure stats&lt;/p&gt;

&lt;p&gt;&lt;em&gt;3️⃣ Dashboards&lt;/em&gt;&lt;br&gt;
A CloudWatch Dashboard is created entirely via Terraform (JSON):&lt;/p&gt;

&lt;p&gt;Widgets include:&lt;br&gt;
Invocation count&lt;br&gt;
Error rate&lt;br&gt;
Duration (Avg + P99 latency)&lt;br&gt;
Concurrent executions&lt;br&gt;
Custom error metrics&lt;br&gt;
Log-based error trends&lt;/p&gt;

&lt;p&gt;This dashboard is production-ready.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;4️⃣ Alerts &amp;amp; Alarms&lt;/em&gt;&lt;br&gt;
Multiple alarm categories are implemented:&lt;br&gt;
❌ Lambda errors&lt;br&gt;
⏱️ High execution duration&lt;br&gt;
🔥 Concurrency limit breaches&lt;br&gt;
📉 Invalid file uploads&lt;br&gt;
🚫 Log-based failures&lt;/p&gt;

&lt;p&gt;All alarms are parameterized via Terraform variables.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;5️⃣ Notifications (SNS)&lt;/em&gt;&lt;br&gt;
Separate SNS topics for alert types&lt;br&gt;
Email subscriptions (manual confirmation)&lt;br&gt;
Real-time alert delivery when alarms trigger&lt;/p&gt;

&lt;p&gt;This completes the incident response loop.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;🐋 Dockerized Lambda Layer Build&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To avoid the classic “works on my machine” problem:&lt;br&gt;
Lambda dependencies (Pillow) are built using Docker&lt;br&gt;
Ensures compatibility with AWS Lambda Linux runtime&lt;br&gt;
Terraform deploys the generated layer artifact&lt;/p&gt;

&lt;p&gt;This is production-grade dependency management.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;🧪 Testing &amp;amp; Failure Simulation&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
The project is actively tested by:&lt;br&gt;
Uploading valid images → metrics increase&lt;br&gt;
Uploading invalid files (PDF/GIF) → error alarms trigger&lt;br&gt;
Uploading large files → size alarms trigger&lt;br&gt;
Uploading multiple files → concurrency alarms trigger&lt;/p&gt;

&lt;p&gt;Alerts are received via email in real time.&lt;/p&gt;

&lt;p&gt;This proves the system actually works.&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>aws</category>
      <category>terraform</category>
      <category>monitoring</category>
    </item>
    <item>
      <title>🚀 Terraform Day 22: Secure Two-Tier Architecture on AWS (EC2 + RDS)</title>
      <dc:creator>Jeeva</dc:creator>
      <pubDate>Sun, 28 Dec 2025 11:39:54 +0000</pubDate>
      <link>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-22-secure-two-tier-architecture-on-aws-ec2-rds-105l</link>
      <guid>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-22-secure-two-tier-architecture-on-aws-ec2-rds-105l</guid>
      <description>&lt;p&gt;&lt;strong&gt;🧱 Architecture Overview&lt;/strong&gt;&lt;br&gt;
The deployed architecture consists of:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;🌐 Web Tier&lt;/em&gt;&lt;br&gt;
EC2 instance in a public subnet&lt;br&gt;
Accessible via public DNS&lt;br&gt;
Runs a Flask application&lt;br&gt;
Uses Security Groups to restrict inbound access&lt;/p&gt;

&lt;p&gt;&lt;em&gt;🗄️ Database Tier&lt;/em&gt;&lt;br&gt;
MySQL RDS instance&lt;br&gt;
Hosted in private subnets&lt;br&gt;
No direct internet access&lt;br&gt;
Accepts traffic only from web tier security group&lt;/p&gt;

&lt;p&gt;&lt;em&gt;🔐 Secrets Management&lt;/em&gt;&lt;br&gt;
Database username &amp;amp; password generated dynamically&lt;br&gt;
Stored securely in AWS Secrets Manager&lt;br&gt;
Retrieved by EC2 during boot via user data&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧩 Terraform Module Design&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This project is built using custom Terraform modules, a critical real-world practice.&lt;/p&gt;

&lt;p&gt;Modules used:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;VPC module&lt;/em&gt;&lt;br&gt;
VPC&lt;br&gt;
Public &amp;amp; private subnets&lt;br&gt;
Internet Gateway&lt;br&gt;
NAT Gateway&lt;br&gt;
Route tables&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Security Group module&lt;/em&gt;&lt;br&gt;
Web SG (HTTP access)&lt;br&gt;
DB SG (MySQL access only from web SG)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Secrets module&lt;/em&gt;&lt;br&gt;
Random password generation&lt;br&gt;
Secrets Manager storage&lt;/p&gt;

&lt;p&gt;&lt;em&gt;RDS module&lt;/em&gt;&lt;br&gt;
MySQL instance&lt;br&gt;
Private subnet placement&lt;br&gt;
Credentials injected from Secrets Manager&lt;/p&gt;

&lt;p&gt;The root module orchestrates everything by passing outputs between modules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔐 Secure Credential Handling (Critical)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the most important lessons in Day 22:&lt;br&gt;
_&lt;br&gt;
❌ No credentials in Terraform code&lt;br&gt;
❌ No credentials in variables.tf&lt;br&gt;
❌ No credentials in user data scripts&lt;/p&gt;

&lt;p&gt;✅ Password generated using random_password&lt;br&gt;
✅ Stored in AWS Secrets Manager&lt;br&gt;
✅ Retrieved securely at runtime_&lt;/p&gt;

&lt;p&gt;This is mandatory in real production environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;⚙️ Application Deployment with User Data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The EC2 instance uses user data to:&lt;br&gt;
Install system dependencies&lt;br&gt;
Install Python and Flask&lt;br&gt;
Fetch database credentials from Secrets Manager&lt;br&gt;
Configure environment variables&lt;br&gt;
Start the Flask application automatically&lt;/p&gt;

&lt;p&gt;Result:&lt;br&gt;
Infrastructure and application deploy together — fully automated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔄 Terraform Workflow Used&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Standard, production-safe workflow:&lt;br&gt;
terraform init&lt;br&gt;
terraform plan&lt;br&gt;
terraform apply&lt;/p&gt;

&lt;p&gt;Notes:&lt;br&gt;
RDS provisioning takes time — expected behavior&lt;br&gt;
Outputs expose application endpoint safely&lt;br&gt;
Infrastructure must be destroyed after testing to avoid costs&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>security</category>
      <category>aws</category>
      <category>terraform</category>
    </item>
    <item>
      <title>🚀 Terraform Day 21: Policy &amp; Governance Automation on AWS</title>
      <dc:creator>Jeeva</dc:creator>
      <pubDate>Fri, 26 Dec 2025 16:10:38 +0000</pubDate>
      <link>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-21-policy-governance-automation-on-aws-hom</link>
      <guid>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-21-policy-governance-automation-on-aws-hom</guid>
      <description>&lt;p&gt;&lt;strong&gt;🎯 What Day 21 Is About&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Day 21 demonstrates how to:&lt;br&gt;
Enforce preventive controls using IAM policies&lt;br&gt;
Enable detective controls using AWS Config&lt;br&gt;
Store audit logs securely in S3&lt;br&gt;
Detect non-compliant resources automatically&lt;br&gt;
Troubleshoot real-world permission behavior&lt;/p&gt;

&lt;p&gt;This is not theory — it’s hands-on governance automation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧠 Policy vs Governance (Core Concept)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Understanding this distinction is mandatory in real projects:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;🔐 Policy (Preventive Control)&lt;/em&gt;&lt;br&gt;
Implemented using IAM policies&lt;br&gt;
Blocks actions before they happen&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
Deny delete without MFA&lt;br&gt;
Deny uploads without encryption&lt;br&gt;
Deny resource creation without required tags&lt;/p&gt;

&lt;p&gt;&lt;em&gt;📊 Governance (Detective Control)&lt;/em&gt;&lt;br&gt;
Implemented using AWS Config&lt;br&gt;
Detects violations after resources exist&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
Unencrypted buckets&lt;br&gt;
Public access enabled&lt;br&gt;
Missing mandatory tags&lt;/p&gt;

&lt;p&gt;👉 Policy stops mistakes. Governance reports mistakes.&lt;br&gt;
Both are required.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🗂️ Secure Audit Bucket with Terraform&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A dedicated S3 bucket is created for governance logs.&lt;br&gt;
Configured with:&lt;br&gt;
✅ Server-side encryption&lt;br&gt;
✅ Versioning enabled&lt;br&gt;
✅ Public access fully blocked&lt;br&gt;
✅ Bucket policy allowing AWS Config access&lt;br&gt;
This bucket becomes the single source of truth for audit data.&lt;/p&gt;

&lt;p&gt;Audit logs must be immutable, private, and durable — Terraform enforces this by design.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔒 IAM Policies for Enforcement&lt;/strong&gt;&lt;br&gt;
Multiple custom IAM policies are created using Terraform.&lt;br&gt;
Examples covered:&lt;br&gt;
MFA enforcement for destructive actions&lt;br&gt;
Encryption-in-transit enforcement for S3 uploads&lt;br&gt;
Mandatory EC2 tagging to enforce cost and ownership standards&lt;/p&gt;

&lt;p&gt;These policies are:&lt;br&gt;
Written as JSON&lt;br&gt;
Managed via Terraform&lt;br&gt;
Attached to users and roles programmatically&lt;/p&gt;

&lt;p&gt;This ensures rules are consistent, repeatable, and reviewable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📈 AWS Config for Continuous Compliance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS Config is enabled end-to-end using Terraform:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Components created:&lt;/em&gt;&lt;br&gt;
Config Recorder&lt;br&gt;
Delivery Channel pointing to the audit bucket&lt;br&gt;
Managed compliance rules&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Rules demonstrated:&lt;/em&gt;&lt;br&gt;
S3 public access prohibited&lt;br&gt;
Encryption enabled on buckets and EBS volumes&lt;br&gt;
Required resource tags&lt;br&gt;
Root account MFA enabled&lt;/p&gt;

&lt;p&gt;AWS Config continuously evaluates infrastructure and reports compliance status automatically&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✅ Key Takeaways&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;✔ Policy = prevention&lt;br&gt;
✔ Governance = detection&lt;br&gt;
✔ Terraform can automate both&lt;br&gt;
✔ Secure audit logging is non-negotiable&lt;br&gt;
✔ AWS Config complements IAM — it does not replace it&lt;br&gt;
✔ Testing policies is as important as writing them&lt;/p&gt;

&lt;p&gt;This is how production AWS accounts are protected.&lt;/p&gt;

</description>
      <category>security</category>
      <category>automation</category>
      <category>aws</category>
      <category>terraform</category>
    </item>
    <item>
      <title>🚀 Terraform Day 20: Building Production Infrastructure Using Custom Terraform Modules</title>
      <dc:creator>Jeeva</dc:creator>
      <pubDate>Thu, 25 Dec 2025 16:33:08 +0000</pubDate>
      <link>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-20-building-production-infrastructure-using-custom-terraform-modules-1pah</link>
      <guid>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-20-building-production-infrastructure-using-custom-terraform-modules-1pah</guid>
      <description>&lt;p&gt;&lt;strong&gt;🧠 What Is a Terraform Module?&lt;/strong&gt;&lt;br&gt;
A Terraform module is a reusable, self-contained package of Terraform code.&lt;/p&gt;

&lt;p&gt;A module typically contains:&lt;br&gt;
&lt;em&gt;main.tf – resources&lt;br&gt;
variables.tf – inputs&lt;br&gt;
outputs.tf – exposed values&lt;/em&gt;&lt;br&gt;
Terraform treats every directory as a module.&lt;/p&gt;

&lt;p&gt;Modules allow you to:&lt;br&gt;
Encapsulate complexity&lt;br&gt;
Enforce standards&lt;br&gt;
Reuse infrastructure patterns&lt;br&gt;
Scale cleanly across teams and environments&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧩 Types of Terraform Modules&lt;/strong&gt;&lt;br&gt;
1️⃣ Public Modules&lt;br&gt;
Available from Terraform Registry&lt;br&gt;
Maintained by providers or the community&lt;br&gt;
Cannot be modified internally&lt;/p&gt;

&lt;p&gt;2️⃣ Partner Modules&lt;br&gt;
Co-managed by HashiCorp and partners&lt;br&gt;
Verified and production-ready&lt;br&gt;
Still externally controlled.&lt;/p&gt;

&lt;p&gt;3️⃣ Custom Modules (Focus of Day 20)&lt;br&gt;
Created and maintained by you or your organization&lt;br&gt;
Full control over:&lt;br&gt;
Code&lt;br&gt;
Versioning&lt;br&gt;
Security&lt;br&gt;
Updates&lt;br&gt;
👉 Production systems rely heavily on custom modules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🏗 Root Module vs Custom Modules&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;🔹 Root Module&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Entry point of the Terraform project&lt;br&gt;
Where terraform init and terraform apply are executed&lt;br&gt;
Orchestrates the entire infrastructure&lt;br&gt;
Sources and connects custom modules&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;🔹 Custom Modules&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Stored as subdirectories inside the root module&lt;br&gt;
Each module has a single responsibility&lt;br&gt;
Do not directly communicate with each other&lt;br&gt;
The root module acts as the central coordinator.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📂 Typical Project Structure (Day 20 Style)&lt;/strong&gt;&lt;br&gt;
terraform-project/&lt;br&gt;
├── main.tf          # Root module&lt;br&gt;
├── variables.tf&lt;br&gt;
├── outputs.tf&lt;br&gt;
├── modules/&lt;br&gt;
│   ├── vpc/&lt;br&gt;
│   │   ├── main.tf&lt;br&gt;
│   │   ├── variables.tf&lt;br&gt;
│   │   └── outputs.tf&lt;br&gt;
│   ├── eks/&lt;br&gt;
│   │   ├── main.tf&lt;br&gt;
│   │   ├── variables.tf&lt;br&gt;
│   │   └── outputs.tf&lt;br&gt;
│   ├── iam/&lt;br&gt;
│   └── secrets/&lt;br&gt;
Each module encapsulates a single infrastructure domain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔁 How Modules Interact (Very Important)&lt;/strong&gt;&lt;br&gt;
Custom modules never talk to each other directly.&lt;/p&gt;

&lt;p&gt;All communication happens through the root module:&lt;br&gt;
Root module calls a custom module&lt;br&gt;
Passes input variables&lt;br&gt;
Custom module creates resources&lt;br&gt;
Custom module exposes outputs&lt;br&gt;
Root module consumes outputs&lt;br&gt;
Outputs are passed into other modules as inputs&lt;/p&gt;

&lt;p&gt;This ensures:&lt;br&gt;
Loose coupling&lt;br&gt;
Clear dependency flow&lt;br&gt;
Maintainable architecture&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔗 Example: VPC → EKS Dependency Flow&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;VPC module outputs vpc_id&lt;/li&gt;
&lt;li&gt;Root module captures vpc_id&lt;/li&gt;
&lt;li&gt;Root module passes vpc_id into EKS module&lt;/li&gt;
&lt;li&gt;EKS resources are created inside the correct VPC
This pattern scales cleanly as infrastructure grows.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;📥 Variables &amp;amp; Outputs in Modular Design&lt;/strong&gt;&lt;br&gt;
Variables&lt;br&gt;
Define what a module expects&lt;br&gt;
Passed from the root module&lt;br&gt;
Keep modules flexible&lt;/p&gt;

&lt;p&gt;Outputs&lt;br&gt;
Define what a module exposes&lt;br&gt;
Used by the root module&lt;br&gt;
Enable inter-module coordination&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Modules behave like functions:&lt;br&gt;
Inputs → Processing → Outputs&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🏁 Conclusion&lt;/strong&gt;&lt;br&gt;
Day 20 transitions Terraform from learning mode to architecture mode.&lt;/p&gt;

&lt;p&gt;This session makes it clear that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Terraform is not just about resources&lt;/li&gt;
&lt;li&gt;Terraform is about designing systems&lt;/li&gt;
&lt;li&gt;Custom modules are the backbone of production IaC&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By mastering modular Terraform architecture, you unlock the ability to build large, maintainable, enterprise-grade cloud platforms.&lt;/p&gt;

&lt;p&gt;This is how Terraform is used in the real world.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>terraform</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>🚀 Terraform Day 19: Provisioners — Bootstrapping Infrastructure with Automation</title>
      <dc:creator>Jeeva</dc:creator>
      <pubDate>Thu, 25 Dec 2025 07:51:27 +0000</pubDate>
      <link>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-19-provisioners-bootstrapping-infrastructure-with-automation-adb</link>
      <guid>https://dev.to/jeeva_5c84a254e90842940dd/terraform-day-19-provisioners-bootstrapping-infrastructure-with-automation-adb</guid>
      <description>&lt;h3&gt;
  
  
  🎯 What Are Terraform Provisioners?
&lt;/h3&gt;

&lt;p&gt;Provisioners are execution blocks that run during the lifecycle of a Terraform resource.&lt;/p&gt;

&lt;p&gt;They are commonly used to:&lt;br&gt;
Run scripts&lt;br&gt;
Install packages&lt;br&gt;
Copy files&lt;br&gt;
Perform post-creation setup&lt;/p&gt;

&lt;p&gt;Provisioners execute only when a resource is created or recreated.&lt;br&gt;
Terraform remains declarative — provisioners are optional escape hatches.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧰 Types of Terraform Provisioners
&lt;/h3&gt;

&lt;p&gt;Terraform supports three main provisioners:&lt;/p&gt;

&lt;p&gt;_1️⃣ local-exec&lt;br&gt;
Runs commands on the machine where Terraform is executed.&lt;/p&gt;

&lt;p&gt;2️⃣ remote-exec&lt;br&gt;
Runs commands on the remote resource (e.g., EC2 instance) via SSH.&lt;/p&gt;

&lt;p&gt;3️⃣ file&lt;br&gt;
Copies files from local machine to remote resource over SSH._&lt;br&gt;
Each has a distinct purpose and execution context.&lt;/p&gt;

&lt;h3&gt;
  
  
  🖥️ Local-Exec Provisioner
&lt;/h3&gt;

&lt;p&gt;local-exec runs locally, not on AWS.&lt;br&gt;
Example use cases:&lt;br&gt;
Logging instance details&lt;br&gt;
Running validation scripts&lt;br&gt;
Triggering local automation&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
provisioner "local-exec" {&lt;br&gt;
  command = "echo Instance ID: ${self.id}, Public IP: ${self.public_ip}"&lt;br&gt;
}&lt;br&gt;
🔹 No SSH required&lt;br&gt;
🔹 Runs on your laptop / CI runner&lt;br&gt;
🔹 Useful for notifications or metadata handling&lt;/p&gt;

&lt;h3&gt;
  
  
  🖧 Remote-Exec Provisioner
&lt;/h3&gt;

&lt;p&gt;remote-exec runs commands inside the EC2 instance.&lt;br&gt;
Requirements:&lt;br&gt;
SSH access&lt;br&gt;
Key pair&lt;br&gt;
Security group allowing port 22&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
provisioner "remote-exec" {&lt;br&gt;
  inline = [&lt;br&gt;
    "sudo yum update -y",&lt;br&gt;
    "echo 'Provisioned by Terraform' &amp;gt; /tmp/info.txt"&lt;br&gt;
  ]&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;This is commonly used to:&lt;br&gt;
Install packages&lt;br&gt;
Configure services&lt;br&gt;
Bootstrap servers&lt;/p&gt;

&lt;h3&gt;
  
  
  📁 File Provisioner
&lt;/h3&gt;

&lt;p&gt;The file provisioner copies files to remote instances.&lt;br&gt;
Example:&lt;br&gt;
provisioner "file" {&lt;br&gt;
  source      = "welcome.sh"&lt;br&gt;
  destination = "/home/ec2-user/welcome.sh"&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Typical pattern:&lt;br&gt;
Copy script using file&lt;br&gt;
Execute script using remote-exec&lt;br&gt;
This allows complex bootstrapping logic.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔐 SSH &amp;amp; Key Pair Requirements
&lt;/h3&gt;

&lt;p&gt;For remote-exec and file provisioners:&lt;br&gt;
EC2 key pair must exist&lt;br&gt;
Private key must have correct permissions&lt;br&gt;
chmod 400 my-key.pem&lt;/p&gt;

&lt;p&gt;Terraform connection block example:&lt;br&gt;
connection {&lt;br&gt;
  type        = "ssh"&lt;br&gt;
  user        = "ec2-user"&lt;br&gt;
  private_key = file("my-key.pem")&lt;br&gt;
  host        = self.public_ip&lt;br&gt;
}&lt;br&gt;
Without proper SSH setup, provisioners will fail.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔄 Understanding Provisioner Execution Behavior
&lt;/h3&gt;

&lt;p&gt;Provisioners do not run on every terraform apply.&lt;br&gt;
They run only when:&lt;br&gt;
A resource is created&lt;br&gt;
A resource is recreated&lt;br&gt;
If no changes are detected, provisioners are skipped.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚠️ Forcing Provisioners with terraform taint
&lt;/h3&gt;

&lt;p&gt;To force re-execution:&lt;br&gt;
terraform taint aws_instance.example&lt;br&gt;
terraform apply&lt;/p&gt;

&lt;p&gt;This:&lt;br&gt;
Marks the resource as dirty&lt;br&gt;
Forces destruction and recreation&lt;br&gt;
Triggers provisioners again&lt;br&gt;
This highlights Terraform’s state-driven behavior.&lt;/p&gt;

&lt;h3&gt;
  
  
  🏁 Conclusion
&lt;/h3&gt;

&lt;p&gt;Day 19 provides a clear and honest view of Terraform provisioners.&lt;/p&gt;

&lt;p&gt;They are powerful, but must be used carefully and intentionally.&lt;br&gt;
Understanding how and when they execute is critical to avoiding unexpected behavior.&lt;/p&gt;

&lt;p&gt;This session strengthens your grasp of Terraform internals, state-driven execution, and real-world automation patterns.&lt;/p&gt;

&lt;p&gt;Provisioners are not the default tool —&lt;br&gt;
but knowing them makes you a stronger Terraform engineer.&lt;/p&gt;

</description>
      <category>automation</category>
      <category>terraform</category>
      <category>devops</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
