ClickOps makes infrastructure unreproducible, undocumented, and hard to audit. This episode covers the principles of Infrastructure as Code, each cloud's native tools, and Terraform, OpenTofu, and Pulumi.

After episode 15, where we built full oversight over the system, this time we attack the root problem that has always haunted manually built infrastructure: the inability to reproduce it. A system that can't be rebuilt identically isn't a system — it's just a one-off artifact that was never truly understood.
This episode covers why infrastructure must be written as code, the native tools each cloud provides, and the agnostic multi-cloud approaches with Terraform, OpenTofu, and Pulumi. By the end of the episode, you'll see infrastructure the way a senior engineer does: as code that can be reviewed, tested, and rolled back.
ClickOps — building infrastructure through console clicks — feels fast and easy, but hides four chronic problems:
Infrastructure as Code (IaC) answers all four by treating infrastructure like application code: written in files, stored in version control, reviewed via pull requests, and deployed repeatedly. The analogy is a cooking recipe: a chef who only memorizes in his head can't pass on his skill, while a written recipe can produce the same taste in a hundred different kitchens.
| ClickOps problem | IaC solution |
|---|---|
| Configuration can't be repeated | One source of truth in files |
| Not documented | Git history is documentation |
| No change trail | Pull requests and code review |
| Rollback impossible | Rollback by checking out an old commit |
There are two paradigms you must distinguish: imperative states the sequence of steps — create the VPC first, then the subnets, then the routes — while declarative only states the end state: "I want this VPC and that subnet" — the tool takes care of the steps. Modern clouds favor declarative because it's idempotent: running the same configuration repeatedly produces the same state, with no side effects.
Note
Remember the connection to episode 15: a system that can't be reproduced also can't be meaningfully monitored. IaC isn't just about creating resources fast — it's about ensuring every environment is truly identical so observability produces comparable data.
Each cloud provides a native IaC tool, most appropriate if you're committed to a single provider:
An example CloudFormation template for a single web instance:
AWSTemplateFormatVersion: '2010-09-09'
Description: Web server sederhana
Resources:
WebServer:
Type: AWS::EC2::Instance
Properties:
InstanceType: t3.micro
ImageId: ami-0abcdef1234567890
SecurityGroupIds:
- sg-0a1b2c3d4e5f67890
Tags:
- Key: Name
Value: web-server-01This file can be committed to git, deployed with one command, and removed with one command too — the entire stack, not resources one by one. Changes are made simply by editing the file and re-deploying; CloudFormation calculates the difference between the current state and the desired one.
Tip
Don't memorize syntax — memorize concepts. CloudFormation, Deployment Manager, and ARM/Bicep all carry the same pattern: template as source of truth, deploy to apply, and a rollback concept when something fails. This skill of moving between tools is what makes you valuable, not the ability to memorize keywords.
Many teams work across clouds or move between providers. For that need, there are agnostic tools not tied to a single cloud:
The key to Terraform is the state file: a record of the resources already created. Every time you run a command, Terraform compares the desired configuration with the state, then composes a plan of changes. The basic workflow:
terraform init # download the required providers
terraform plan # create a change plan, without applying
terraform apply # apply the plan to the cloud
terraform destroy # remove all managed resourcesBefore applying anything, run terraform plan first. That command produces a summary of how many resources will be added, changed, and deleted — the last chance to inspect before changes actually execute. This small habit saves production from accidental deletion.
The output of terraform plan speaks through three symbols you must understand:
Terraform used the selected providers to generate the following execution plan.
# aws_instance.web will be updated in-place
~ resource "aws_instance" "web" {
~ instance_type = "t3.large" -> "t3.medium"
tags = { "Name" = "web-server-01" }
}
# aws_security_group.allow_https will be created
+ resource "aws_security_group" "allow_https" {
+ name = "allow-https"
+ description = "Allow inbound HTTPS"
}
Plan: 1 to add, 1 to change, 0 to destroy.+ symbol means a new resource to be created.~ symbol means an existing resource to be changed.- symbol means a resource to be deleted.The last line summarizes everything. Before pressing apply, you only need to ask one question: is what's being deleted or changed really what you intended? That simple question saves production more often than you'd think.
IaC opens the door to larger patterns:
terraform plan on every pull request, then terraform apply after it's approved and merged.Important
The state file contains the complete mapping of your infrastructure — it's a critical asset that must not be lost and whose access must be restricted. Store it in a remote backend with versioning, secure access with IAM, and enable locking so two people don't overwrite each other's changes. A corrupted state makes IaC lose all its ability to heal itself.
In this episode 16 you learned the foundation of modern infrastructure: the why of IaC — fighting ClickOps for systems that are reproducible, documented, and auditable; the declarative and idempotent paradigm; native tools — CloudFormation, Deployment Manager, and ARM/Bicep for single-cloud teams; and agnostic tools — Terraform, OpenTofu, and Pulumi for multi-cloud teams. You also got to know the plan-before-apply workflow and advanced automation patterns like infrastructure CI/CD and centralized state.
But automation that makes creating resources as easy as breathing has a dark side: cost. The same ease can balloon a bill overnight — environments forgotten to be turned off, instances that are too large, and storage that's never archived. The next episode, FinOps, Cost Management & Cloud Optimization, teaches you to control this one side — because a cost-efficient cloud is as important as an automated one.