Skip to content

Phase 9 — Validating Terraform Locally Without an AWS Account

Phase 8 left the Humor Memory Game fully deployed on the Raspberry Pi K3s cluster and reachable from the internet through a Cloudflare Tunnel — infrastructure and delivery both working end to end. What it didn’t have was any way to validate the DevOps-Home-Lab-2026-2027 Terraform configuration itself — the hub-and-spoke VPC, private EKS cluster behind a bastion, Multi-AZ RDS, VPC endpoints — the architecture that, in principle, this same project could deploy to real AWS. Running terraform apply against real AWS to test a config change costs real money and takes 20–30 minutes per cycle. Running it against a broken config costs the same, plus a cleanup.

I wanted a way to validate that Terraform daily — catch bugs, test module changes, prove the whole thing actually works — without an AWS bill attached to every mistake. This post covers finding a way to do that entirely locally, and the real problems that came with it.

First attempt: LocalStack’s free tier doesn’t cover this anymore

Section titled “First attempt: LocalStack’s free tier doesn’t cover this anymore”

LocalStack used to be the default answer here. Its free Community tier no longer includes RDS or EKS — both are gated behind paid plans now. That ruled it out for a personal project with no budget for infrastructure I’m not even deploying to.

Second attempt: real infrastructure, one confirmed gap

Section titled “Second attempt: real infrastructure, one confirmed gap”

I moved to LocalEmu, a free alternative that, with the right flags set (RDS_DOCKER_BACKEND=1, EKS_K8S_PROVIDER=k3s), backs its services with genuine Docker containers rather than just returning API-shaped fake responses. This mattered enormously — I could psql into a real Postgres 15 instance and get a real version string back, not a canned response.

VPC, security groups, a bastion host, RDS — all proved out as real, working infrastructure. Ten actual bugs in the upstream Terraform repo got found and fixed along the way (a circular security group dependency, IAM attachment issues, an RDS backup/maintenance window overlap, an EKS cluster name over AWS’s length limit, among others) — genuine Terraform-code problems that would have caused equally confusing failures against real AWS.

The one thing that never worked: EKS. The cluster reported ACTIVE, node groups showed correctly, IAM wiring looked right — every API call said everything was fine. But no real Kubernetes container ever existed behind it. aws eks update-kubeconfig returned a non-resolving hostname pointing at nothing. Infrastructure-level proof was solid; the one thing I actually needed — real kubectl access to deploy the app — wasn’t there.

The fix: an emulator with a real Kubernetes control plane

Section titled “The fix: an emulator with a real Kubernetes control plane”

I found MiniStack, a newer MIT-licensed alternative, and tested its EKS support directly rather than trusting the README: eks create-cluster via the raw AWS CLI, then docker ps. A real rancher/k3s container showed up, genuinely running.

The AWS-native aws eks update-kubeconfig path didn’t work — MiniStack’s fake IAM/STS can’t back the real token-exchange flow that command relies on. But pulling the kubeconfig directly out of the container (docker exec <container> cat /etc/rancher/k3s/k3s.yaml) worked immediately. kubectl get nodes returned a genuine, Ready node with a real k3s version string. That’s the proof that mattered — not the label on the API response, but an actual Kubernetes API answering real questions.

Building the full stack, and hitting real emulator-specific bugs along the way

Section titled “Building the full stack, and hitting real emulator-specific bugs along the way”

Once EKS was confirmed real, I ran the complete Terraform module set against MiniStack — VPC, security groups, bastion, RDS, EKS, VPC endpoints — and hit two genuine, permanent quirks worth documenting for anyone doing similar work:

OIDC/IRSA is structurally broken on this emulator. MiniStack’s OIDC issuer URL uses http, and Terraform’s tls_certificate data source requires https/tls — a hard rejection, not a retry-able error. The fix was scoping the resources that depend on it (aws_iam_openid_connect_provider, the IRSA role) out of the apply entirely with -target, and treating IRSA as untestable on this particular local setup.

EKS node groups fight the state file on every apply, forever, unless told to stop. MiniStack’s DescribeNodegroup API doesn’t return the update_config attribute back, even though it was set correctly at creation. Every subsequent terraform plan reads that as drift and tries to fix it via an API route MiniStack never implemented (UpdateNodegroupConfig), producing an identical, permanent failure on every apply from that point forward. The fix is a lifecycle { ignore_changes = [update_config] } block on the resource — telling Terraform to stop reconciling an attribute that only appears to drift because of how the emulator reports state, not because anything real changed.

Neither of these is a bug in the Terraform config. Both are cases where the emulator’s API responses don’t perfectly match real AWS’s, and the fix is understanding why well enough to route around it precisely — rather than disabling drift detection broadly and losing the thing that makes Terraform trustworthy in the first place.

Deploying the real app, and one more honest gap

Section titled “Deploying the real app, and one more honest gap”

With a real cluster running, I deployed the actual Humor Memory Game — frontend, backend, Redis, and pointed the backend at MiniStack’s real RDS instance instead of an in-cluster database. Two more real, worth-documenting issues: MiniStack’s k3s ships without a working local-path-provisioner, so PersistentVolumeClaims hang indefinitely — emptyDir is the correct substitute for anything that doesn’t need to survive a pod restart. And Terraform provisions an RDS instance, not its schema — the database needs its own explicit init step regardless of which cloud (real or emulated) it’s running on.

The payoff: a genuine GET /api/health 200 loop, backed by a real Postgres connection and a real Redis connection, running on a cluster Terraform actually built.

The test that mattered most: does any of this survive a reboot?

Section titled “The test that mattered most: does any of this survive a reboot?”

Infrastructure that only works until you restart the host isn’t infrastructure — it’s a demo. I tested this directly rather than assume either way. Without any persistence configuration, a host reboot destroyed the RDS and EKS containers entirely — not just stopped, genuinely removed, confirmed by docker start failing with “No such container.” MiniStack’s own internal API record was wiped too; this wasn’t a stale-state problem, it was total data loss with nothing left to reconcile against.

MiniStack documents an RDS_PERSIST=1 flag specifically for this. I set it, rebuilt, and tested it with an actual sudo reboot rather than trusting the documentation. The result: every table, every row, survived — confirmed by checking row counts against known seed data, not just confirming the container started. The Kubernetes cluster’s entire state survived too — every Deployment, Secret, and Pod came back exactly as they were, since the container itself was merely stopped rather than removed, and a stopped container’s filesystem persists regardless of any application-level flag.

Recovery from a full host reboot, in the end, was two commands: docker compose up -d, then docker start on the two application containers. Everything else — the whole application stack, externally reachable through its own dedicated tunnel — came back on its own.

What this actually proves, and what it doesn’t

Section titled “What this actually proves, and what it doesn’t”

Worth being precise about scope, since it’s easy to overclaim a result like this. What’s genuinely real here: VPC and subnet routing, security group enforcement, a real Postgres database, and a real Kubernetes API doing real scheduling and real service discovery. What isn’t: EC2 exists only as an API record with no backing container, IAM doesn’t enforce real cross-service permissions the way AWS does, and there’s no multi-AZ failover behind the “Multi-AZ” label — it’s one container, not a distributed system.

This is a genuinely rigorous environment for validating Terraform logic and running the real application against real dependencies. It’s not a behavioral twin of AWS’s control plane, and treating it as one would be the same mistake as trusting LocalEmu’s ACTIVE EKS status without ever actually testing kubectl.

The discipline that mattered most across this whole project wasn’t picking the right tool — it was refusing to trust any tool’s status output until I’d verified the real thing behind it myself.