Lessons learned
Three Terraform failures that only a real AWS account shows
ClipForge's infrastructure is a single Terraform setup: an EC2 instance for the API, a frontend on S3 and CloudFront, DNS records, and a storage bucket. GitHub Actions brings it up on demand and tears it down afterwards. I tested the Terraform in two ways that run without an AWS account: terraform validate, and a LocalStack gate that applies it against a fake AWS locally.
Neither can know the facts of a real account, and the first applies against mine failed three separate times for exactly that reason.
The three failures
The disk was too small. The Amazon Linux 2023 image I picked has a snapshot that needs at least 30 GB. I had asked for a 20 GB root volume, and AWS refused. The fix was one number:
volume_size = 30
The subnet couldn't run the instance. I let Terraform take the first subnet in the default network. Not every availability zone offers every instance type, and that zone didn't offer mine. Now the code asks AWS which zones offer the instance type and picks a subnet from one of those:
data "aws_ec2_instance_type_offerings" "available" {
filter {
name = "instance-type"
values = [var.instance_type]
}
location_type = "availability-zone"
}
The server's permission didn't match its own script. The instance reads its secrets from AWS Systems Manager when it boots. I had granted ssm:GetParameters, the plural action, but the start-up script calls get-parameter, which needs the singular ssm:GetParameter. The box came up and couldn't read its keys. Changing one word in the IAM policy fixed it.
The real fix: shorten the loop
Each of those failures cost a full GitHub Actions run to see: build the image, push it, apply, wait, read the error. Fixing three of them that way was slow.
So I wrote a script that runs a real terraform plan from my machine against the real account, using the same variables the workflow uses. It never applies anything. A plan is read-only, but it asks AWS the account-specific questions, so problems like a missing IAM action or a disk size surface in seconds instead of after a full pipeline run.
What I'd tell a client
- Local checks and fake clouds catch typos and wrong types. They can't know your account's limits, regions or permissions. Budget one real, read-only plan before you trust a pipeline.
- Put that check on your own machine, not only in CI. A feedback loop of seconds changes how you work.
- Treat infrastructure that goes up and down on demand like a product: the first apply against a real account is a test, not a formality.
What this doesn't cover
ClipForge isn't running publicly. The setup is built to deploy and tear down on demand, and it's shown through a recorded run. The three failures above are the ones I hit on my account and region, not a list of everything that can go wrong.
The code from this post is public: https://github.com/hassan91199/clipforge/blob/main/infra/modules/ec2_api/main.tf. The read-only plan script is scripts/infra_plan_real.sh in the same repo (https://github.com/hassan91199/clipforge).
If your infrastructure code works locally and breaks in the real account, book a call with me on Upwork.