Terraform Fundamentals
Terraform is a tool for describing and managing infrastructure through configuration files. It compares those files with existing systems, proposes changes, and uses provider plugins to create, update, or remove resources through their APIs.
itInfrastructure and operations | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic: Terraform Fundamentals
Terraform is a way to describe infrastructure in files and ask a program to compare that description with the objects that actually exist. Before this, someone tended to perform a sequence of API calls, console clicks, and carefully preserved folklore. That can work. So can carrying water in a sieve, if the journey is short enough.
The useful mental model has three parts. Configuration says what resources and relationships are intended. State remembers which Terraform resource address belongs to which remote object. Providers are the plugins that read and change those remote objects through platform APIs. Terraform compares all three and writes a plan, which is a proposal rather than a small army of commands escaping into production.
The surprising part is state. It is not a receipt that can be discarded after a successful apply. It contains the bindings Terraform needs to recognize existing infrastructure. A shared remote backend gives a team one record of those bindings and can lock an operation, but state and saved plans can contain sensitive values. They deserve the same care as other operational data, although the filename may look disappointingly harmless.
The working rhythm is pleasantly repetitive: write, initialize, plan, review, apply. Initialization installs required providers and modules and prepares the backend. A plan can create, update, replace, or destroy objects. terraform validate checks syntax and internal consistency, but it does not inspect a remote service or declare a replacement wise. The plan is where the awkward questions live, so read it before asking apply to become very efficient.
Terraform works best for lasting objects exposed by a suitable provider and API. It is less useful for a one-time procedure with no managed object. Start with the disposable Docker example, where a container can be built, changed, and destroyed without opening a cloud account. Then move to the Cheatsheet for the compact map of blocks, state, and plan actions; the Practice tab for the command cycle; and the Timeline and Landscape tabs when the basic loop starts to look like a larger operating system.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://developer.hashicorp.com/terraform/intro
Supports
- Terraform purpose and declarative infrastructure model
- Configuration, provider, state, plan, and apply overview
- https://developer.hashicorp.com/terraform/language
Supports
- Configuration language purpose
- Resources, expressions, and dependencies
- Configuration as a collection of managed infrastructure
- https://developer.hashicorp.com/terraform/language/providers
Supports
- Providers as API plugins
- Resource types and data sources
- Provider requirements, versions, and installation
- https://developer.hashicorp.com/terraform/language/resources
Supports
- Resource configuration and provider-defined behavior
- Create, update, replace, and destroy operations
- https://developer.hashicorp.com/terraform/cli/init
Supports
- Working-directory initialization
- Provider and module installation
- Backend and local working-directory data
- https://developer.hashicorp.com/terraform/cli/commands/plan
Supports
- Plan comparison and proposed actions
- Speculative and saved plan behavior
- Applying a saved plan in automation
- https://developer.hashicorp.com/terraform/cli/commands/validate
Supports
- Syntax and internal-consistency validation
- Exclusion of remote service checks
- https://developer.hashicorp.com/terraform/language/state
Supports
- State bindings and metadata
- Refresh and state storage
- https://developer.hashicorp.com/terraform/language/state/purpose
Supports
- Required mapping between addresses and remote objects
- Shared remote state and supported locking
- https://developer.hashicorp.com/terraform/language/modules/configuration
Supports
- Child-module reuse
- Module sources, inputs, outputs, and versions
- https://developer.hashicorp.com/terraform/language/style
Supports
- Configuration maintainability
- Versioning and sensitive-data guidance
- https://developer.hashicorp.com/terraform/tutorials/docker-get-started
Supports
- Disposable local Docker learning path
- Build, change, destroy, variable, and output practice
- https://developer.hashicorp.com/terraform/tutorials/cli/plan
Supports
- Initialize, plan, and apply workflow
- Saved plan use and sensitive plan contents
- https://github.com/shuaibiyy/awesome-terraform
Supports
- Selection of terraform-docs, TFLint, Checkov, Infracost, and Atlantis
- Curated ecosystem descriptions
- https://terraform-docs.io/
Supports
- Module documentation generation
- https://github.com/terraform-linters/tflint
Supports
- Pluggable Terraform linting
- https://www.checkov.io/
Supports
- Terraform configuration and plan security scanning
- https://www.infracost.io/
Supports
- Terraform cloud cost estimates in CLI and pull requests
- https://www.runatlantis.io/
Supports
- Pull-request-driven Terraform plan and apply
- https://github.com/hashicorp/terraform/releases/tag/v0.10.0
Supports
- Terraform v0.10.0 release
- Provider distribution separation from Terraform CLI
- https://github.com/hashicorp/terraform/releases/tag/v0.12.0
Supports
- Terraform v0.12 language overhaul
- First-class expressions and richer module values
- https://github.com/hashicorp/terraform/releases/tag/v0.13.0
Supports
- Third-party provider installation and provider namespaces
- count, for_each, and depends_on for modules
- https://github.com/hashicorp/terraform/releases/tag/v0.14.0
Supports
- Sensitive input propagation
- Dependency lock file generation
- https://github.com/hashicorp/terraform/releases/tag/v1.0.0
Supports
- Terraform v1.0 stability milestone
- Terraform v1.x compatibility promise
- https://github.com/hashicorp/terraform/releases/tag/v1.1.0
Supports
- moved blocks for declarative state address migration
- https://github.com/hashicorp/terraform/releases/tag/v1.5.0
Supports
- Configuration-driven import blocks
- Generated configuration for imported resources
- https://github.com/hashicorp/terraform/releases/tag/v1.6.0
Supports
- terraform test framework
- https://github.com/hashicorp/terraform/releases/tag/v1.7.0
Supports
- removed blocks and expanded test workflow
- https://www.gruntwork.io/blog/how-to-manage-terraform-state
Supports
- Shared state, locking, isolation, and remote-state tradeoffs
- https://www.gruntwork.io/blog/how-to-manage-multiple-environments-with-terraform
Supports
- Environment isolation tradeoffs among workspaces, branches, and separate configuration
- https://www.gruntwork.io/blog/how-to-manage-large-opentofu-terraform-state-files
Supports
- State-file size effects on refresh time, review scope, and blast radius
- https://developer.hashicorp.com/terraform
Supports
- Terraform CLI product and documentation
- https://opentofu.org/
Supports
- OpenTofu product and community distribution
- https://www.hashicorp.com/products/terraform
Supports
- HCP Terraform and Terraform Enterprise product offerings
- https://spacelift.io/
Supports
- Spacelift infrastructure delivery platform
- https://www.env0.com/
Supports
- env0 infrastructure automation platform
- https://www.scalr.com/
Supports
- Scalr Terraform automation platform
- https://www.runatlantis.io/
Supports
- Atlantis pull-request automation product
