100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Infrastructure as Code (IaC) Concepts Cheat Sheet

Infrastructure as Code (IaC) Concepts Cheat Sheet

Summarizes core IaC principles including declarative vs imperative approaches, idempotency, state management, and drift detection.

1 PageBeginnerFeb 20, 2026

Core IaC Concepts

Foundational vocabulary shared across IaC tools.

  • Declarative- You describe the desired end state; the tool figures out how to get there (Terraform, CloudFormation)
  • Imperative- You specify the exact steps/commands to reach a state (shell scripts, older Chef recipes)
  • Idempotency- Applying the same configuration repeatedly produces the same result without side effects
  • State File- Record of the resources IaC currently manages and their real-world attributes
  • Drift- When real infrastructure diverges from what's defined in code (e.g. manual console change)
  • Plan/Diff- A dry-run showing what will change before applying, without modifying real resources
  • Immutable Infrastructure- Servers are replaced rather than modified in place when a change is needed

IaC Tool Landscape

Common tools and where they fit.

  • Terraform- Multi-cloud declarative provisioning using HCL, tracked via state files
  • AWS CloudFormation- AWS-native declarative IaC using JSON/YAML templates
  • Pulumi- Declarative infra defined using general-purpose languages (TypeScript, Python, Go)
  • Ansible- Primarily configuration management, agentless, uses YAML playbooks
  • AWS CDK- Defines CloudFormation stacks using imperative code that synthesizes to declarative templates

Minimal Terraform Example

Declarative resource definition demonstrating idempotent provisioning.

hcl
resource "aws_instance" "web" {  ami           = "ami-0abcdef1234567890"  instance_type = "t3.micro"  tags = {    Name = "web-server"  }}# terraform plan   -> shows proposed changes# terraform apply  -> reconciles real infra to match this file# terraform destroy -> tears down managed resources
Pro Tip

Never let engineers make manual console changes to IaC-managed resources — even small manual edits cause drift that silently gets reverted (or conflicts) on the next apply.

Was this cheat sheet helpful?

Explore Topics

#InfrastructureAsCodeIaCConcepts#InfrastructureAsCodeIaCConceptsCheatSheet#CloudComputing#Beginner#CoreIaCConcepts#IaCToolLandscape#MinimalTerraformExample#Summarizes#InfrastructureAsCode#CheatSheet#SkillVeris