🚀 Launch Special: $29/mo for life --d --h --m --s Claim Your Price →

Terraform Fundamentals

The course teaches Terraform fundamentals, covering HCL syntax, providers, resources, variables, outputs, locals, CLI workflow, and state management, enabling learners to build and manage infrastructure as code efficiently.

Who Should Take This

It is ideal for DevOps engineers, system administrators, and developers who are new to Infrastructure as Code or have limited Terraform experience. Participants seek to automate cloud provisioning, understand state handling, and adopt best practices for reproducible infrastructure deployments across multiple cloud platforms.

What's Included in AccelaStudy® AI

Adaptive Knowledge Graph
Practice Questions
Lesson Modules
Console Simulator Labs
Exam Tips & Strategy
20 Activity Formats

Course Outline

57 learning goals
1 HCL Syntax and Configuration Basics
2 topics

HCL Language Fundamentals

  • Identify the core HCL constructs including blocks, arguments, expressions, and comments and describe how they form the structure of a Terraform configuration file
  • Describe the HCL type system including primitive types (string, number, bool), collection types (list, map, set), and structural types (object, tuple) and explain type conversion behavior
  • Implement string interpolation and template directives within HCL expressions to construct dynamic values from variable references and function calls
  • Implement HCL expressions using built-in functions for string manipulation (format, join, split, replace), numeric operations (max, min, ceil, floor), and collection transformations (length, keys, values, lookup)

Terraform Settings and Configuration Structure

  • Describe the purpose and structure of the terraform settings block including required_version and required_providers and explain how version constraints control compatibility
  • Implement a well-organized Terraform project structure with separate files for main configuration, variables, outputs, and provider settings following community conventions
  • Analyze the role of the .terraform.lock.hcl dependency lock file and evaluate how it ensures reproducible provider installations across team environments
2 Providers and Resources
3 topics

Provider Configuration

  • Describe the role of Terraform providers as plugins that interact with cloud APIs and explain the provider registry namespace format (registry.terraform.io/hashicorp/aws)
  • Implement provider configuration blocks with authentication credentials, region settings, and version constraints for at least one major cloud provider
  • Analyze the security implications of hardcoded credentials in provider blocks versus environment variables and shared credential files for provider authentication

Resource Definitions

  • Describe the anatomy of a resource block including the resource type, local name, required arguments, and optional arguments and explain how Terraform maps resources to provider APIs
  • Implement resource configurations for common infrastructure components such as compute instances, storage buckets, and networking constructs with required and optional attributes
  • Implement resource references using attribute expressions to establish implicit dependencies between resources and explain how Terraform determines creation ordering
  • Analyze the difference between implicit dependencies through attribute references and explicit dependencies using depends_on and evaluate when each approach is appropriate

Data Sources

  • Describe the purpose of data sources in Terraform and explain how they differ from managed resources in terms of lifecycle and state behavior
  • Implement data source blocks to query existing infrastructure such as AMI IDs, availability zones, and existing VPC configurations for use in resource definitions
  • Evaluate when to use data sources versus hardcoded values versus variables for referencing existing infrastructure and analyze the maintainability trade-offs
3 Variables, Outputs, and Locals
2 topics

Input Variables

  • Describe the variable block syntax including type, default, description, validation, sensitive, and nullable arguments and explain when each is appropriate
  • Implement input variables with complex types including lists of objects, maps of strings, and nested object types with optional attributes
  • Implement custom validation rules within variable blocks using the validation block with condition expressions and error_message strings
  • Analyze the variable definition precedence order including environment variables, terraform.tfvars, auto.tfvars, -var flags, and -var-file flags and evaluate how conflicts are resolved

Output Values and Locals

  • Describe the purpose of output values in Terraform and explain how they expose resource attributes for consumption by other configurations or human operators
  • Implement output blocks with value expressions, descriptions, and the sensitive flag to expose computed infrastructure attributes after apply
  • Implement local values using the locals block to define intermediate computed expressions that reduce repetition across resource configurations
  • Evaluate the trade-offs between using local values, input variables, and inline expressions for common patterns such as naming conventions and tag maps
4 Terraform CLI and Workflow
2 topics

Core CLI Commands

  • Describe the purpose and execution order of terraform init, plan, apply, and destroy and explain what each command produces as output artifacts
  • Implement the terraform plan command with various flags including -out, -var, -var-file, -target, and -refresh-only to generate and save execution plans
  • Implement terraform apply with saved plan files and auto-approve flags and explain the difference between interactive and non-interactive apply workflows
  • Analyze the risks of terraform destroy in production environments and evaluate safeguards such as prevent_destroy lifecycle rules and targeted destruction

Formatting and Validation Commands

  • Implement terraform fmt to enforce canonical HCL formatting and terraform validate to check configuration syntax and internal consistency without accessing remote APIs
  • Implement terraform console to interactively evaluate HCL expressions, test function calls, and debug variable interpolations during development
  • Implement terraform graph to visualize resource dependency relationships and explain how the dependency graph affects parallelism during apply operations
5 State Management
2 topics

State Concepts

  • Describe the purpose of Terraform state as the mapping between configuration resources and real-world infrastructure objects and explain why state is essential for plan and apply operations
  • Describe the structure of the terraform.tfstate file including resource metadata, attribute values, and dependency information stored in JSON format
  • Analyze the security risks of storing sensitive data in state files and evaluate mitigation strategies including encryption at rest, restricted access, and the sensitive attribute

State Operations

  • Implement terraform state list and terraform state show commands to inspect the current state and view detailed attributes of managed resources
  • Describe the concept of state locking and explain how it prevents concurrent modifications from corrupting the state file during team collaboration
  • Analyze the differences between local state and remote state backends and evaluate when a team should migrate from local to remote state storage
  • Implement terraform refresh to reconcile state with real-world infrastructure and explain how drift detection identifies resources that have been modified outside Terraform
6 Modules and Code Reuse
2 topics

Using Modules

  • Describe the concept of Terraform modules as self-contained packages of configuration and explain the distinction between root modules and child modules
  • Implement module blocks to consume published modules from the Terraform Registry by specifying source, version constraints, and input variable values
  • Implement local path modules using relative source paths to organize related resources into reusable configuration packages within a project
  • Analyze the benefits and limitations of module encapsulation and evaluate how module boundaries affect resource visibility, output exposure, and provider inheritance

Module Design Basics

  • Describe the standard module structure convention including main.tf, variables.tf, outputs.tf, and README.md files and explain their respective purposes
  • Implement a basic reusable module with well-defined input variables, output values, and sensible defaults that can be invoked from multiple root configurations
  • Evaluate the trade-offs between monolithic configurations and modular decomposition and analyze criteria for deciding when to extract resources into a separate module
7 Lifecycle Management and Provisioners
3 topics

Resource Lifecycle Rules

  • Describe the three lifecycle meta-arguments (create_before_destroy, prevent_destroy, ignore_changes) and explain their effect on Terraform's default create-update-delete behavior
  • Implement create_before_destroy lifecycle rules for resources that cannot tolerate downtime during replacement such as DNS records and load balancer attachments
  • Implement ignore_changes lifecycle rules to prevent Terraform from reverting changes made outside of Terraform such as auto-scaling group sizes or manually applied tags
  • Analyze scenarios where lifecycle rules conflict with desired infrastructure behavior and evaluate how prevent_destroy interacts with terraform destroy and resource replacement

Provisioners

  • Describe the types of provisioners available in Terraform including local-exec, remote-exec, and file and explain when provisioners execute during the resource lifecycle
  • Implement local-exec provisioners to run scripts on the machine executing Terraform and remote-exec provisioners to execute commands on newly created resources via SSH or WinRM
  • Implement the connection block within provisioners to configure SSH or WinRM access including host, user, private_key, and timeout settings for remote execution
  • Analyze why HashiCorp recommends provisioners as a last resort and evaluate alternative approaches such as cloud-init, user_data, and configuration management tools for post-creation setup

Resource Tainting and Replacement

  • Describe the concept of resource tainting and explain how terraform taint and the -replace flag force resource recreation during the next apply cycle
  • Implement targeted resource operations using the -target flag to limit plan and apply scope to specific resources or modules during troubleshooting scenarios
  • Evaluate the risks and appropriate use cases for targeted operations and resource replacement and analyze how partial applies can lead to state inconsistencies

Scope

Included Topics

  • HashiCorp Configuration Language (HCL) syntax and semantics, Terraform providers and resource definitions, data sources, input variables and output values, local values, state management basics, core CLI commands (init, plan, apply, destroy, fmt, validate), module basics (using published modules), provisioners, lifecycle rules (create_before_destroy, prevent_destroy, ignore_changes), terraform.tfvars and variable precedence, resource dependencies (implicit and explicit), Terraform settings and required_providers blocks

Not Covered

  • Advanced remote state backends (S3, GCS, Azure Blob configuration)
  • Terraform Cloud and Terraform Enterprise features
  • Policy as code (Sentinel, OPA)
  • Advanced module authoring and publishing
  • Workspaces beyond CLI basics
  • CI/CD pipeline integration
  • Terratest and automated testing frameworks
  • Dynamic blocks and advanced iteration patterns

Ready to master Terraform Fundamentals?

Adaptive learning that maps your knowledge and closes your gaps.

Subscribe to Access