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.
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.
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.
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.
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:
- main.tf / main.yml declaration of the main resources
- variables.tf / vars.yml configurable input parameters — avoid hardcoded values
- outputs.tf important values generated after provisioning (IPs, DNS, resource IDs)
- providers.tf provider and version definitions (AWS, Azure, GCP...)
- terraform.tfvars actual variable values — never commit passwords or secrets here
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
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:
- feat: add VPC module for the dev environment
- fix: correct inbound rule on the database security group
- docs: update deployment instructions in the README
Day-to-day commands
| command | function |
|---|---|
| git status | shows 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.
HashiCorp Terraform
Official support: autocomplete, syntax highlighting, and real-time validation.
GitLens
Shows line-by-line authorship and history right inside the editor.
YAML / JSON Tools
Essential for anyone working with Ansible, CloudFormation, or Kubernetes.
Prettier / EditorConfig
Keeps code formatting standardized automatically.
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:
- HashiCorp Registry (Terraform) — the definitive reference for parameters on any provider (AWS, Azure, OCI, GCP).
- AWS Documentation — full detail on every native AWS resource, including CloudFormation.
- Ansible Documentation — complete guides on modules and playbooks.
- Terraform AWS Modules — great for studying how the community builds reusable modules and advanced patterns.
- Awesome Terraform — a curated list of tools, books, and utilities across the ecosystem.
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.
Next post: leading in mission-critical — what running a fintech's NOC taught me.
See all posts