Summary
Keywords
Full Transcript
In a past stream, I deployed our API using Terraform user_data. It worked, but it was incorrect. If I changed a single environment variable, Terraform would destroy the entire server—database and all—just to update a config. In Day 78, we fix this by implementing a proper Separation of Concerns. We are refactoring our pipeline to let Terraform handle Infrastructure (EC2, IPs, Security Groups) and GitHub Actions handle Application Deployment (Docker, Code, Env Vars). In this live refactor: The user_data Trap: Why baking app logic into server boot scripts leads to accidental data loss. The Refactor: Stripping setup.sh and 100+ lines of variables out of Terraform. Infrastructure Layer: restricting Terraform to only care about "Does the server exist?" Application Layer: Building a GitHub Actions workflow that SSHs into the server to run docker compose up. Secret Management: Stopping the leak of .env files into the Terraform State. By the end, you will have a pipeline where you can update your app 100 times a day without ever touching your infrastructure. Join discord community: https://discord.gg/Db5vQDSj Watch the full playlist: https://www.youtube.com/playlist?list=PLdtwawCR2QjmdfhM-7SzDOVGop373bbgW GitHub Repo (Public Mirror): https://github.com/KNehe/aero_bound_ventures-public.git Subscribe to master Software Engineering #Terraform #DevOps #GitHubActions #AWS #CICD #InfrastructureAsCode #Refactoring
