Successfully set up Terraform for my personal site today—without nuking AWS. 😅
Terraform can be intimidating. One wrong command and you can wipe out your infra. Learned that the hard way on a QA stack with CloudFormation.
Today I wanted to import my existing AWS setup—S3, ECR, CloudFront—into Terraform. I skipped Route 53 for now (curious if anyone thinks I should include it).
The Approach:
Started manually with S3 resources—good way to understand the infrastructure. CloudFront? For me it seemed complex to write by hand, so I used Terraform’s generate-import feature and it worked surprisingly well. Then I imported my ECR repo the same way. Configured an S3 backend for Terraform to store the state, making my infrastructure safe, reproducible, and ready for CI/CD.
Then, I ran terraform plan to verify changes (only added some tags). Adjusted IAM permissions—AWS threw a few 403s—but once fixed, terraform apply went smoothly. Verified my site was up and all resources are intact.
Takeaways:
I now have an automated, reproducible infrastructure without downtime or risk. Terraform v1.5 import improvements make managing existing infra much safer. Doing some manual work first gives better understanding and control.
Next Steps:
Integrate Terraform into GitHub Actions with secure secrets.
Build Terraform configs for a Dockerized environment.
Explore Kubernetes: EKS or K3s locally.
TL;DR:
I now have a safe, reproducible setup for my site. Learned a lot about Terraform imports, IAM permissions, and CloudFront quirks. Ready to apply these lessons to bigger projects.
Have you ever used Terraform and what are your thoughts on the generate configuration feature? Always open to feedback.
Here's my current folder structure for my .tf files.