WintelGuy.com

Terraform Associate Exam Cram - Part 2

Understand the purpose of Terraform (vs other IaC)

This is the Part 2 of the Terraform Associate Exam Cram. It covers the following Terraform Associate Certification exam objectives:

2a. Explain Multi-Cloud and Provider-Agnostic Benefits

Terraform is an infrastructure as code (IaC) tool that lets you define and manage infrastructure resources through declarative, human-readable configuration files.

  • Provider-agnostic:
    • Plugin-Based Architecture works with many platform and infrastructure providers.
    • Utilizes same configuration language and unified workflow for management of different infra resources and cloud platforms.
  • Multi-cloud:
    • Allows to manage different clouds in one config without cloud vendor lock-in.
    • Consolidates management and orchestration for large-scale, multi-cloud infrastructures.
    • Supports hybrid infra (cloud + on-prem + SaaS).

Comparing Terraform to Other IaC Tools

  • Terraform vs Cloud-native Tools (e.g., AWS CloudFormation, Azure ARM, GCP Deployment Manager):
    • Cloud-native tools → vendor-specific & single-cloud only.
    • Terraform → Multi-cloud and provider-agnostic.
    • Terraform supports composable modules and standard syntax across clouds.
  • Terraform vs Configuration Management Tools (Ansible, Chef, Puppet, Salt):
    • Terraform → Focuses on infra provisioning (VMs, networks, load balancers, storage, SaaS).
    • Config management → Focuses on OS/software configuration inside servers.
    • They can complement each other: Terraform builds infra, config management tool configures it.

Advantages of Terraform

  • Multi-cloud support with a single workflow.
  • Standardized language → human-readable and consistent.
  • Infrastructure version control with version control systems (VCS).
  • Reusability via modules.
  • Extensibility with custom providers.
  • Idempotency - same config applied multiple times leads to same result.

Back to Top

2b. Explain the Benefits of State

Terraform stores information about your infrastructure in a state file (terraform.tfstate). This state file keeps track of resources created by your configuration and maps them to real-world resources.

Benefits of State

  • Mapping Real Resources to Config
    • State keeps track of which resources in the cloud map to which resources in Terraform config.
    • Enables Terraform to know what exists and what needs changes.
  • Performance / Efficiency
    • Without state Terraform would have to re-scan cloud resources during every operation.
    • State acts as a local cache of the attribute values for all resources enabling faster operations.
  • Dependency Tracking
    • Terraform uses state to build the resource dependency graph.
    • Ensures correct order of create/update/destroy actions.
  • Metadata Storage
    • State is used to track metadata such as resource dependencies and some provider configuration details.
  • Drift Detection
    • By comparing config vs state vs actual infra, Terraform detects drift (changes made outside Terraform).
    • Ensures desired state is reconciled with current infra resources.
  • Collaboration
    • Remote state backends (S3, GCS, HCP Terraform, etc.) allow sharing state for teams.
    • State locking prevents simultaneous conflicting operations.

Back to Top

Practice Questions

How does Terraform handle infrastructure drift?
What happens if a resource is deleted manually outside of Terraform and you run terraform apply again?
What is the main purpose of Terraform?
How does Terraform differ from configuration management tools like Ansible or Chef?
What makes Terraform "cloud-agnostic" compared to other IaC tools?
How does Terraform's execution model differ from procedural tools like Ansible?
What is the purpose of the Terraform state file?
Why might a team choose Terraform over a cloud-specific tool like AWS CloudFormation?
Can Terraform manage both cloud resources and external services like GitHub or Datadog?

Back to Top