Ready to Work Together?
Let's discuss how our expertise can help transform your business.
Alex Podobnik
·
Apr 24, 2026
Every consulting engagement has the same moment. The client walks you through their AWS account and at some point says "yeah, someone set that up manually a while back." Then you open the console and find 15 EC2 instances, a dozen S3 buckets, and a VPC with security groups that no one fully understands. All created by hand. None of it in Terraform.
Getting this stuff under Terraform management is one of the most tedious jobs in infrastructure work. Not because it's hard. Because it's slow. You're mapping JSON output to HCL arguments, looking up import ID formats, and running terraform plan over and over until the diff is clean.
Claude Code changes the workflow significantly. Instead of doing each step manually and copy-pasting between terminals, you can hand it the whole job and let it run. Here's how we've been doing it at NextLink Labs.
The traditional workflow for importing a single resource looks something like this:
For one resource, this takes maybe 15 minutes. For 50 resources, it's a full day or more. Most of that time is spent on steps 3 through 6, which is just mechanical translation work.
Before you start importing anything, add your Terraform conventions to a CLAUDE.md file in your repo root. Claude Code reads this automatically at the start of every session, so you don't repeat yourself on every prompt.
This keeps the output consistent across sessions and means you can hand this workflow to anyone on your team without them needing to know the right prompts.
Here's the big shift from the chat interface. Claude Code has access to your shell, which means it can run AWS CLI commands directly. You don't need to pre-pull JSON files and feed them in.
Claude Code will run the describe commands itself, read the output, and write the Terraform files. You're watching it work instead of doing the translation by hand.
For this to work you just need your AWS credentials configured in whatever shell Claude Code is running in. If you're using profiles, mention which one:
This is the part that makes Claude Code significantly faster than the chat interface. Instead of you running terraform plan, reading the diff, pasting it back, and asking for fixes, Claude Code does the whole cycle.
Claude Code will:
That loop of plan, read, fix, re-plan is where most of the time goes in manual imports. Having Claude Code do it unattended compresses that from 15 to 20 minutes per resource down to a couple of minutes. You just review the final result.
For larger jobs, tell Claude Code to work through a set of resources:
Claude Code will iterate through the list, running CLI commands, writing HCL, and validating as it goes. For 25 buckets this takes maybe 20 to 30 minutes of Claude Code working while you do something else. Doing it by hand would be most of a day.
You can also scope it down if you don't want to import everything at once:
One thing worth calling out. We always use the Terraform 1.5+ import block syntax instead of the terraform import CLI command. Claude Code will default to this if you've got it in your CLAUDE.md, but it's worth understanding why.
Import blocks are declarative. They live in your code, they're reviewable in merge requests, and they run as part of terraform plan and apply. The CLI command is imperative and modifies state directly, which makes it harder to track and easier to mess up.
Claude Code generates them like this:
For most resources the import ID is just the resource ID. But some have weird formats. Security group rules use a compound ID like sg-123_ingress_tcp_443_443_0.0.0.0/0. IAM policy attachments need an ARN. Claude Code knows these formats, so you don't have to look them up.
This workflow is a good fit when:
It's not a replacement for understanding what you're importing. You still need to decide on module structure, naming, and how resources relate to each other. Claude Code handles the mechanical part. You handle the architecture decisions.
Importing hand-built infrastructure is never going to be fun. But Claude Code takes it from a multi-day grind to something you can knock out in an afternoon. The key is the agentic loop. Instead of you being the one running the plan, reading diffs, and editing files, Claude Code does all of that and you just review the results.
Start with a small batch. Maybe one VPC and its subnets. Get comfortable with the flow before you point it at an entire account. And always review the final HCL before you apply.
Author at NextLink Labs
Most LLM-generated Terraform is bad — not because of the tool, but because of the prompt. Here's how NextLink Labs uses Claude Code and CLAUDE.md conventions to generate Terraform modules that are close to merge-ready.
Alex Podobnik
·
Apr 24, 2026
One account becomes five, and eventually nobody knows which guardrails are where. Here's how NextLink Labs manages AWS Organizations, OU hierarchies, and Service Control Policies with Terraform and GitLab CI.
Colin Soleim
·
Apr 22, 2026
One account becomes five, and eventually nobody knows which guardrails are where. Here's how NextLink Labs manages AWS Organizations, OU hierarchies, and Service Control Policies with Terraform and GitLab CI.
Alex Podobnik
·
Apr 22, 2026
Let's discuss how our expertise can help transform your business.