🌐

Terraform and Infrastructure Concepts

Jul 25, 2025

Overview

This lecture covers the fundamentals of Terraform, a popular Infrastructure as Code (IaC) tool, and compares it to other configuration management and provisioning tools relevant to the CCNA exam.

Infrastructure as Code (IaC)

  • Infrastructure as Code (IaC) manages infrastructure using machine-readable configuration files instead of manual processes.
  • IaC tools include Ansible, Puppet, Chef, and Terraform.
  • IaC enables automation, consistency, scalability, and repeatability in infrastructure management.

Configuration Management vs Provisioning

  • Configuration management tools (Ansible, Puppet, Chef) manage existing infrastructure by installing software and maintaining system state.
  • Provisioning tools (Terraform) create, modify, and delete infrastructure resources, focusing on initial setup.
  • Tools like Terraform (provisioning) and Ansible (configuration) are often used together for complete infrastructure lifecycle management.
  • There is some functional overlap, but each tool has a primary strength.

Mutable vs Immutable Infrastructure

  • Mutable infrastructure can be modified after deployment; changes are applied to existing resources (used by config management tools).
  • Immutable infrastructure cannot be changed after deployment; changes involve replacing resources (used by provisioning tools like Terraform).
  • Immutable infrastructure reduces configuration drift.

Procedural vs Declarative Approaches

  • Procedural (imperative) approach: user specifies steps and order for configuration (e.g., Ansible, Chef).
  • Declarative approach: user defines desired end state; tool determines necessary steps (e.g., Terraform, Puppet).
  • Declarative approach simplifies management and ensures consistency.

Terraform Basics

  • Terraform is an open-source, agentless IaC tool developed by HashiCorp for provisioning infrastructure.
  • Supports 1000+ providers including AWS, Azure, GCP, Kubernetes, Cisco Catalyst Center, ACI, and IOS XE.
  • Uses a push model and does not require agents on managed devices.
  • Terraform Core runs on a server, processes configuration files, and interacts with providers using APIs.
  • State file tracks the current state of deployed infrastructure for accurate management.
  • Main components: Terraform Core, configuration files, state file, and providers.

Terraform Workflow & Configuration

  • Workflow consists of three main steps: write (define resources), plan (review changes), apply (execute changes).
  • Terraform Core is written in Go; configuration files use HashiCorp Configuration Language (HCL), a domain-specific language (DSL).
  • The "destroy" step can be used to remove infrastructure when no longer needed.

Key Terms & Definitions

  • Infrastructure as Code (IaC) — managing infrastructure using code files instead of manual configuration.
  • Provisioning — creating and setting up new infrastructure resources.
  • Configuration Management — maintaining and updating existing infrastructure.
  • Mutable Infrastructure — infrastructure modified in place after deployment.
  • Immutable Infrastructure — infrastructure replaced rather than modified when changes are needed.
  • Procedural Approach — explicitly specifying steps and commands for management.
  • Declarative Approach — specifying the desired end state, letting the tool determine the steps.
  • Provider — system/platform where infrastructure is deployed and managed by Terraform.
  • State File — file tracking the current state of managed resources.
  • HCL (HashiCorp Configuration Language) — DSL for writing Terraform configuration files.

Action Items / Next Steps

  • Review the basics of Terraform, IaC, and how they compare to Ansible, Puppet, and Chef for the CCNA exam.
  • Be able to distinguish between procedural vs declarative, and mutable vs immutable infrastructure approaches.
  • Optionally, read Chapter 25 of "Acing the CCNA Exam, Volume 2" for additional context.