r/Terraform

I got tired of missing things in 600-line Terraform PR reviews, so I built a free Action that posts an architectural diff back as a comment
▲ 1 r/Terraform+1 crossposts

I got tired of missing things in 600-line Terraform PR reviews, so I built a free Action that posts an architectural diff back as a comment

Hey r/Terraform —

Long-time lurker, first-time poster. I built a tool called ArchiteX because I kept reviewing huge terraform plan diffs and missing the one line that mattered. Sharing it here because this is the audience that will tell me, honestly, whether it's actually useful or just my own itch.

What it does: drop-in GitHub Action. On every PR that touches *.tf, it parses base + head, builds a resource graph for each, computes the architectural delta (added / removed / changed nodes and edges), runs a set of weighted risk rules, and posts a sticky comment with:

  • a 0–10 risk score with explainable reasons (each rule weight is documented and capped at 10.0)
  • a plain-English summary of what changed and why a reviewer should care
  • a focused Mermaid diagram of only the changed nodes + one layer of context — not the whole topology
  • an optional CI gate (mode: blocking) for high-risk changes
  • an audit bundle uploaded as a workflow artifact (summary.md, score.json, egress.json, a self-contained report.html, and a SHA-256 manifest)

Why I think it's different from tfsec / Checkov: those are great at "this line is misconfigured". ArchiteX answers "what changed in the architecture?" — a brand-new public entry point, an SG flipping from 10.0.0.0/16 to 0.0.0.0/0, a resource gated behind count = var.create ? 1 : 0 that you didn't notice was being toggled on. It's the architectural-delta layer on top of those tools, not a replacement. Run them side-by-side.

Things I made deliberate calls on:

  • No LLM in the hot path. Template-based renderer. Same input → byte-identical output across runs, machines, contributors. I wanted a tool where re-running can never quietly change a score and erode reviewer trust.
  • Local-only. Raw HCL never leaves the runner. The only network call is the GitHub REST API call to post the comment. No SaaS, no telemetry, no account, no paid tier.
  • Conditional resources are first-class. Module-author repos have lots of count = var.x ? 1 : 0. Those resources get rendered as conditional phantoms (? prefix in the diagram) and explicitly excluded from per-resource rules so they can't false-positive.
  • Self-contained HTML report — no JS, no CDN, no remote fonts. Open it in an air-gapped browser, the full report renders.

Coverage today: 45 AWS resource types across 7 abstract roles (network, access control, compute, entry points, data, storage, identity), 18 weighted risk rules. Multi-provider (Azure/GCP) is on the roadmap.

Free + MIT. Single Go binary, single Action, zero config to start.

What I'd love your help with:

  1. What breaks it in your repo? Coverage gaps are the #1 thing I want to fix. If you have a Terraform pattern that ArchiteX mis-parses or misses entirely, the smallest reproducer you can paste in an issue is the highest-value contribution I can ask for.
  2. Are the rule weights sensible? They're calibrated to my own taste and a small group of testers. I'd love to hear "rule X at weight Y is too high/low for my team's risk tolerance."
  3. Module authors — does materializing conditional count resources as phantoms match what you'd want, or would you rather have a separate "module health" mode entirely?

Will answer every comment in the thread.

u/nilipilo — 5 hours ago
▲ 0 r/Terraform+1 crossposts

GitHub repo rename caused silent webhook drift in Terraform (CodeBuild stopped triggering)

Hit a subtle issue where CodeBuild completely stopped triggering after renaming a GitHub repo.

Pushes worked fine. No errors. No failed builds. Just… nothing happening.

Turns out GitHub deletes the webhook during a repo rename. Terraform still thinks the webhook resource exists under the old repo name, so it doesn’t recreate it.

Result:
No webhook → no trigger → no builds

Took a while to track down because there’s no failure signal, just absence.

Fix was:

  • Update the repo URL in the CodeBuild source
  • Force recreate the webhook (terraform destroy -target=aws_codebuild_webhook.main then apply)

Wrote up the full breakdown and why this happens:
https://jch254.com/blog/renaming-github-repo-breaks-codebuild/

jch254.com
u/jch254 — 18 hours ago
▲ 40 r/Terraform+1 crossposts

I try to build a VS Code & JetBrains extension that maps your Terraform resources as an interactive graph

I kept working on infra codebases where nobody had a clear picture of how Terraform resources relate to each other modules, data sources, providers all tangled with no visual map.

So I built an extension that scans your .tf files, discovers resources and their dependencies, and renders an interactive topology graph inside your IDE. It also picks up Kubernetes, Docker Compose, .NET Aspire and ArgoCD so you see the full picture from infra to deployment in one place.

Works in both VS Code and JetBrains IDEs. I named it Mesh Infra 🙂

Would love feedback from community, especially on what IaC relationships or resource types would make incident triage faster.

u/Ok-Pickle-3985 — 2 days ago

Shipped health-check plugins for both gh and gcloud after this week's Anthropic release chaos — open source, read-only

Opus 4.7 breaking changes, Haiku 3 retirement, the MCP STDIO CVE, five Claude Code point releases, and the sandbox api.github.com block (claude-code#37970) all landed inside one 7-day window. A lot of CLI setups broke without obvious error messages.

We put up two plugins in the MSApps-Mobile/claude-plugins marketplace to catch the common failure modes:

github-cli-health-check — dual-path (Routine + Cowork/Desktop Commander host-Mac fallback). Works around the sandbox blocking api.github.com REST and GraphQL by keeping a second path that runs gh on your actual machine. → https://github.com/MSApps-Mobile/claude-plugins/tree/main/plugins/github-cli-health-check

gcloud-cli-health-check — 11 read-only checks (version, auth, ADC, project, billing, enabled APIs, Artifact Registry, Cloud Run, Secret Manager, budget, trial). Fully GCLOUD_HC_* env-var driven so it works against any GCP project. → https://github.com/MSApps-Mobile/claude-plugins/tree/main/plugins/gcloud-cli-health-check

Both MIT. Never print tokens or secret values. Never mutate. Skip-don't-fail on missing optional config. PRs welcome.

reddit.com
u/True-Barber7392 — 10 hours ago
▲ 0 r/Terraform+1 crossposts

Help: Cloud compute connection setup

I’m currently dealing with a somewhat complex setup and need guidance on the correct approach.

I’ve migrated my database from Google Cloud SQL to a PostgreSQL instance running inside a Docker container on a Compute Engine VM.

My application is hosted on a separate Compute Engine VM.

Additionally, my infrastructure is provisioned using Terraform, and the VM running the PostgreSQL container:

- Does not have a public IP

- Uses Cloud NAT for outbound internet access

Now I need to connect my application (running on another VM) to this PostgreSQL database.

I’m unsure about the correct setup for:

- Network configuration between the two VMs (private VPC communication)

- Which host/IP should be used (internal vs external)

- How to correctly construct the DATABASE_URL

- Firewall rules and port exposure (e.g., PostgreSQL on 5432)

- Any edge cases or best practices (security, private networking, IAM, latency, etc.)

What is the recommended way to securely and reliably connect my app VM to the PostgreSQL container running on another private VM within the same GCP environment?

reddit.com
u/gatorboi326 — 2 days ago

Installing terraform with tenv: key expired?

Is anyone else seeing this:

> $ tenv tf install 1.5.7 > Installing Terraform 1.5.7 > Fetching release information from https://releases.hashicorp.com/terraform/1.5.7/index.json > Downloading https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_linux_amd64.zip > Downloading https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_SHA256SUMS > Downloading https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_SHA256SUMS.sig > Downloading https://www.hashicorp.com/.well-known/pgp-key.txt > Error: Signature Verification Error: Invalid signature caused by openpgp: key expired

This is happening on all Terraform versions I have tried.

Looks like the workaround is to set (if you have the right version of tenv) TENV_VALIDATION=sha

reddit.com
u/sausagefeet — 2 days ago
▲ 10 r/Terraform+2 crossposts

Complete Terraform Provider: Closed Alpha - Seeking Testers

Over the last few years (and especially the last four months) I've been working on a source-backed terraform provider that covers all Unifi Network API endpoints, verifying schemas and logic against the controller, tediously documenting every aspect of the APIs as they exist in the controller .deb. Some resources have 240+ configurable fields, like Network Configs.

As one person with limited physical hardware I can only test so far, so at this point I am calling it "alpha" stage and looking for testers who understand the risk of having to readopt devices if something goes wrong.

I've also built out a generator that writes the entire terraform config from a live controller, making the whole config importable from the jump.

Closed Alpha, because people will disregard warnings and nuke production, but please DM me and I can grant access.

Proof: I built a poor man's generator years ago with pure bash / jq, and have been rebuilding the provider from scratch since: https://github.com/robbycuenot/unifi-tf-generator

u/cuenot_io — 4 days ago

A little tool that allows claude sanity-check the terraform plans

I always feel nervous before applying terraform while scrolling through a 500 line plan looking for something I'd missed, so I wrote a small tool for myself. It takes the plan JSON and the git diff, hands both to Claude, and gets back a short review: stuff like does the plan match what you changed, and is anything scary. Usage is basically `tfrev review --plan plan.json` and it prints a little table with the findings.

It's been catching stuff I would have normally missed especially when the diff is large. It's been mostly helpful so far. I had a few friends use it with their Jenkins pipelines and it seems to be helpful for them too, so I cleaned it up enough (I think) to share in case anyone else wants it: https://github.com/bishalOps/tfrev

Just a heads up that some chunks of this were written with Claude's help, mostly the CI templates, some of the test scaffolding, and the README. The core stuff and the plan/diff parsing I iterated on by hand because that's where the product actually lives. It felt appropriate given the tool itself is just a Claude wrapper at the end of the day.

I am just curious if the idea is useful to anyone besides me, or if I'm just bad at reading plans lol.

oh btw, the cost is usually between 0.03 - 0.15 depending on the diff size and amount of tf files involved.

u/Any_Construction6948 — 4 days ago

Preparing for Terraform Associate 004 Certification Exam

HELP!
I just passed AWS SAA C03 certification exam, and now I am thinking about getting Terraform Certified. I visited their site and found this " https://developer.hashicorp.com/terraform/tutorials/certification-004 " guide there. How helpful is this guide, or do I prepare from other materials.

Background:

  • Used Terraform at work and managed the Infra from GUI afterwards because importing to terraform from AWS and then changing the code seemed exhaustive.
  • Know basics on using tfvars, blocks like resource, dynamic, depends on... output and variables
u/Substantial_Chef_857 — 3 days ago

I built a free tool to generate architecture diagrams from Terraform code — no signup, no cloud credentials

https://preview.redd.it/vyrpj41e00wg1.png?width=800&format=png&auto=webp&s=776e1654dd235fe282ae0b7d5d18e351ecd76058

I got tired of spending an hour in draw.io every time someone asked for an architecture diagram. Existing tools like Cloudcraft want $49/month and access to your AWS account.

So I built InfraSketch — paste your Terraform HCL or docker-compose.yml, get a clean diagram with official AWS icons instantly. Everything runs client-side, your code never leaves your browser.

What it does:

  • Parses 25+ AWS resource types
  • Detects resource relationships automatically
  • Groups by category (networking, compute, database, storage)
  • Uses official AWS architecture icons
  • Export as PNG, SVG, or draw.io file (open directly in diagrams.net and edit further)
  • 100% free, open source

Created the blog to show, how it works
Try it: https://infrasketch.cloud GitHub: https://github.com/pandey-raghvendra/infrasketch

Built with vanilla JS, no backend, hosted on GitHub Pages. Would love feedback — what resource types or features should I add next?

reddit.com
u/Repulsive_Wait8232 — 3 days ago
🔥 Hot ▲ 82 r/Terraform

Finally, the ability to use dynamic module source strings is coming to Terraform 1.15.x

Sorry if this has been posted, but was reviewing the release notes for the upcoming 1.15.0 (currently in RC) and noted this.

> Terraform now supports variables and locals in module source and version attributes

Finally! And here is the PR of the change: https://github.com/hashicorp/terraform/pull/38217

TL;DR: you will be able to define variables as const = true - those variables then in turn will be allowed to be used with module.source= string/values.

So keen to see this - certainly better in instances where I'm passing &ref=vXX strings into module paths for versioning pinning - can now reuse these values in a variable for an entire configuration. Great!

u/magnetik79 — 6 days ago
🔥 Hot ▲ 55 r/Terraform

Claude Code Skill for Terraform and OpenTofu: testing, modules, CI/CD, very token optimized

I just shipped a Claude Code & Codex skill that aggregates Terraform Best Practices, largely based on official HashiCorp best practices plus a bunch of other trusted sources I have collected over the years.

There's a couple skills out there already, so let me tell you why I created this skill.

Other skills burned through my tokens. So I checked their reference files and they basically just copied a couple best practice collections + terraform docs and pasted it in md files. Claude reads all of it and it's super expensive.

So I created a different approach. The agent diagnoses most likely failure modes (such as blast radius or secret exposure), and reads only targeted reference files. This is far leaner and far more token efficient, and it works IMO equally well or even better.

Similar to other skills it eliminates LLM hallucinations with Terraform. Curious about feedback!

PS: I also have a 5 min YT video where I demo the skill: https://www.youtube.com/watch?v=2N1TuxndgpY

github.com
u/trolleid — 5 days ago

Built two Terraform templates for secure AWS infrastructure mapped to NIST 800-53 controls

Been deploying AWS infrastructure as code for a personal project while on active duty Navy. Figured I'd clean it up and share it as reusable templates since I couldn't find anything that explicitly mapped controls to NIST 800-53.

Two templates:

Secure Serverless App Stack — Lambda + API Gateway + DynamoDB + WAF with least-privilege IAM

Secure Static Site — S3 + CloudFront + WAF + security headers (HSTS, CSP, X-Frame-Options) + ACM + Route 53

Both include a NIST SP 800-53 control mapping table in the README so you know exactly which controls each resource satisfies (AC-2, AC-6, AU-2, SC-5, SC-8, SC-28, SI-3, etc.).

GitHub repos:

  • github.com/KenFlowe/terraform-secure-serverless-app
  • github.com/KenFlowe/terraform-secure-static-site
reddit.com
u/playa4040 — 5 days ago

Valuable or not: What if Finance / FinOps would only chase you when it really matters?

Hi there, I have an idea for a Terraform tag allowing to track significant cloud cost changes back to specific code changes and teams. The main purpose of the tag would not be to give engineers direct cost visibility and recommendations, but rather to help Finance / FinOps to efficiently and effectively track the most important cost deviations back to the commit that caused them and only chase engineers when they are sure it's their recent deployment that caused the cost spike. Do you believe this to be valuable or not?

reddit.com
u/Pitiful_Turnip9421 — 5 days ago

azurerm 4.67 yields new feature registration resource so you can now build encrypted AKS clusters natively in Terraform

I've been tracking an issue to enable feature registrations via Terraform which has been opened for some time (opened in 2023!) and just recently saw it make its way to release 🎉

I decided to write a quick post giving a brief overview of what feature registrations are in Azure and how we can now, as per the title, create encrypted AKS clusters in a Terraform-native way. Enjoy!

blog.codycodes.cloud
u/codycodescloud — 7 days ago

I built an Open-source CLI to convert existing cloud resources into Terraform/OpenTofu code using AI

Hey folks,

I'm Arunim, founding engineer at StackGuardian. I built an open-source tool called terraclaw that takes your existing cloud infrastructure and generates modular Terraform/OpenTofu HCL from it — not just a flat import, but structured code with modules, variables, dependency wiring, and import scripts.

How it works:

- Discovers resources via Steampipe (AWS + Azure)

- Interactive terminal UI to browse and select resources with dependency expansion

- You can register your own Terraform modules from git repos — it parses them via HCL and scores how well they fit your selected resources, then uses them as hard constraints during generation

- Runs import and iterates until terraform plan shows zero drift

It's written in Go, works with both Terraform and OpenTofu (just set TERRAFORM_BIN=tofu), and everything runs locally.

I'm looking for people to try it out and tell me what's broken, what's missing, or what would make it actually useful for your workflow. Issues and PRs welcome.

GitHub: https://github.com/arunim2405/terraclaw

If you find it useful, a star would really help with visibility. Thanks!

P.S: Sill in Beta, please use READ ONLY credentials.

u/Arunim_2k — 5 days ago

Looking for Terraform Associate Exam Preparation Advice

Hi,

I’m planning to get the Terraform Associate certification, but I have never worked with Terraform before. Could you please share the courses you took, as well as any examples or hands-on labs you practiced before taking the exam?

I would really appreciate any recommendations or resources that helped you prepare for the certification.

Thank you in advance!

reddit.com
u/Classic_Army842 — 8 days ago
▲ 0 r/Terraform+1 crossposts

Update - TrustOS Automated terraform PR's to fix AWS cloud misconfigurations

Hello Everyone.

A week ago I posted about TrustOS and got some really useful feedback here. Made changes based on what you all pointed out and looking for more thoughts.

What it does:

Scans your AWS infrastructure across S3, EC2, IAM, KMS, RDS and CloudTrail, detects misconfigurations against 29 controls across SOC 2, ISO 27001, HIPAA and GDPR, then automatically generates the Terraform code to fix each violation and opens a GitHub pull request. You review and merge. Nothing touches production without your approval.

Changes made based on feedback:

The biggest concern from last time was AWS permissions. Replaced the broad ReadOnlyAccess policy with a custom least-privilege IAM policy that lists the exact actions TrustOS needs for each service it scans. No s3:Get*, no reading actual data whatsoever. Configuration metadata only. The full policy is documented in the README so you can audit it before connecting anything.

The scanning engine is also open source so you can see exactly what gets fetched from your account.

Looking for:

Honest feedback on the permission scope, anything that looks off in the approach.

Links:

Website : trust-os-sigma.vercel.app (Won't invest on a domain just yet - need proper validation on the idea)

Github : https://github.com/abdmath/TrustOS-Docs

reddit.com
u/ungabunga609 — 6 days ago

Terragrunt Introduction

If you’re managing Terraform across multiple environments, Terragrunt can help reduce repetition and keep configurations easier to maintain.

Useful for developers working with infrastructure as code at scale.

youtu.be
u/Efficient-Public-551 — 7 days ago