Ryan Dunne
Final Year Student @ SETU Carlow
TerraLock is a Go-based command-line tool that compares your live AWS infrastructure against your Terraform source of truth — surfacing unmanaged resources and generating ready-to-use Terraform blocks to close the gap.
Infrastructure drift happens when live cloud resources diverge from their Terraform definitions — through manual console changes, failed teardowns, or out-of-band automation. TerraLock automates the detection process: it fetches your Terraform config directly from GitHub, scans your live AWS EC2 instances, and produces a diff report with generated Terraform blocks for any unmanaged resources found. The result is faster remediation and a reliable, auditable path back to infrastructure-as-code.
Point TerraLock at a GitHub repo and it pulls your .tf files directly — no local checkout needed.
Your Terraform is parsed using HashiCorp's HCL library, extracting every declared resource into a structured list.
TerraLock queries AWS live across EC2, Security Groups, IAM Roles, S3 Buckets, and VPCs.
Live resources are checked against your Terraform declarations. Anything in AWS but not in code is flagged as drift.
Each missing resource is converted into a valid, ready-to-import .tf block with all attributes populated.
Drop the generated file into your repo, run terraform import, drift resolved.
terralock scan compares live cloud resources against
declared Terraform configurations to surface all unmanaged resources.
The "scan" command outputs a .tf file containing generated
Terraform Resource blocks ready to import or apply.