My first steps with Infrastructure as Code (IaC)

August 2026 · 8 min read iac terraform

Automating cloud resource provisioning has stopped being a nice-to-have and become a baseline requirement for anyone working with modern infrastructure. Trading manual console clicks for writing code takes a real shift in mindset — but the payoff in reproducibility, security, and control is worth every bit of the learning curve.

If you're starting that journey now, here are the pillars I use to structure my study environment and adopt good practices from day one.

Initial setup: preparing the ground

Before writing a single line of Terraform, CloudFormation, or Ansible, it's worth adjusting your study foundation.

if: training

Structured training

Investing in good sources of knowledge shortens the learning curve a lot. Practice-focused courses — like Mateus Müller's, which cover IaC in a direct, no-fluff way — are great starting points for understanding real-world application.

if: sandbox

Study/sandbox account on AWS

Never use a production environment — or your company's — for testing. Create a dedicated, personal account, and set up AWS Budget alerts right away to avoid a surprise on the credit card bill.

if: repository

Code repository

Every piece of code needs a home. A GitHub (or GitLab) account to version your projects becomes, over time, your portfolio and your record of progress.

if: editor

Code editor (VS Code)

VS Code is the market standard for IaC. On its own it's already good; equipped with the right set of extensions, it becomes far more than a text editor.

Best practices for structuring IaC

Treating infrastructure as code means holding it to the same quality bar we already apply to traditional software development.

File organization

Avoid putting your entire infrastructure into one giant file. A basic modular structure already makes reading and maintenance much easier:

Naming convention

I use snake_case for blocks and variables (e.g. aws_security_group.web_sg), always with descriptive names — aws_instance.web_server_prd conveys far more than aws_instance.instancia1. And I standardize tags on every resource: at minimum

Environment ManagedBy Project Owner

Infrastructure as code only earns the name if someone besides you can read it, understand it, and trust it.

Efficient versioning with Git

Git is the central tool in any IaC workflow. Using it well guarantees full traceability of what changed in your infrastructure over time.

Clear commit messages

I avoid generic commits like "fixes" or "tweaks." I follow the Conventional Commits convention:

Day-to-day commands

commandfunction
git statusshows the state of modified files in the working directory
git add .stages changes for the next commit
git commit -m "msg"records changes in history with a description of what was done
git pull origin <branch>fetches and merges the latest changes from the remote repository
git push origin <branch>sends local commits to the remote repository
git checkout -b <name>creates and switches to a new development branch

Optimizing VS Code for infrastructure

To boost productivity and catch syntax errors before even running the code, VS Code needs the right extensions.

if: terraform

HashiCorp Terraform

Official support: autocomplete, syntax highlighting, and real-time validation.

if: gitlens

GitLens

Shows line-by-line authorship and history right inside the editor.

if: yaml-json

YAML / JSON Tools

Essential for anyone working with Ansible, CloudFormation, or Kubernetes.

if: formatter

Prettier / EditorConfig

Keeps code formatting standardized automatically.

if: aws-toolkit

AWS Toolkit

Makes it easy to view AWS resources right from the editor panel.

Official documentation and reference sources

No matter how experienced you get, documentation stays your daily working tool. The references I keep bookmarked:

Mastering Infrastructure as Code is a marathon, not a sprint. Start by creating simple resources in your test account, version every step in Git, and keep your environment organized from the start — the rest comes with repetition.

The first "terraform apply" that works on the first try is luck. The tenth is skill.

Next post: leading in mission-critical — what running a fintech's NOC taught me.

See all posts