RousselTMLEARNING

Article · Terraform: from discovery to expertise

Principles, architecture and workflow

1. Declarative infrastructure as code #

Describing the desired state.

Principle #

With Terraform, you describe the desired state of the infrastructure in HCL files; Terraform computes the actions needed to get there (create, modify, delete) and runs them in the right order thanks to a dependency graph.

Terraform architecture
More than 4,000 providers exist: clouds, Kubernetes, DNS, monitoring, SaaS.

2. The workflow #

init, plan, apply, destroy.

Commands #

Terraform workflow
The plan has no effect: it shows what is going to change.
terraform init          # télécharge les fournisseurs, configure le backend
terraform fmt -recursive && terraform validate
terraform plan -out=plan.tfplan
terraform apply plan.tfplan
terraform output
terraform destroy       # supprime tout ce que gère cette configuration

Reading a plan #

SymbolMeaning
+Creation
~In-place update
-/+Replacement (destroy then create)
-Destruction

3. The ecosystem #

Terraform, OpenTofu, HCP Terraform.

Overview #

ToolDescription
TerraformHashiCorp's tool (BSL license since 2023)
OpenTofuOpen source fork (MPL 2.0) from the Linux Foundation, compatible
HCP TerraformManaged service: remote state, runs, policies, private registry
Terraform RegistryPublic providers and modules
Good practice: Pin the version of Terraform and the providers (required_version, required_providers) for reproducible runs.

📄 Terraform: principles, architecture and workflow →

My progress

  • ⏱ Estimated time : ≈ 4 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

Recommended Articles

Terraform modules: designing, versioning and reusing

Structure Terraform with modules: root module and child modules, inputs and outputs, sources (loc...

Infrastructure as Code on Azure: Bicep, Terraform, Cost Management and Well-Architected

Describe and deploy Azure as code with Bicep (modules, parameters, what-if, pipeline deployments)...

Infrastructure as Code on AWS: CloudFormation, CDK, Terraform and Well-Architected

Describe and deploy your AWS infrastructure as code with CloudFormation, the CDK or Terraform, au...

Operating OVHcloud: Terraform, monitoring, security, costs and sovereignty

Operate OVHcloud in production: infrastructure as code with the ovh and openstack Terraform provi...

End-to-end CI/CD (1/5): principles and anatomy of a pipeline

Understand end-to-end CI/CD: continuous integration, continuous delivery and continuous deploymen...

Automation and infrastructure as code for Elasticsearch: API, Terraform, Ansible and CI/CD

Automate Elasticsearch administration: REST API and clients, the elasticstack Terraform provider ...

Operating Google Cloud: observability, security, infrastructure as code and costs

Operate Google Cloud: Cloud Monitoring, Cloud Logging and Cloud Trace (Google Cloud Observability...

Vagrant: overview and vocabulary (box, provider, provisioner, Vagrantfile)

The essential notions for following the Vagrant course: what Vagrant is for, the lifecycle of an ...

Cloud native: definition and principles of a cloud native application

What is cloud native? The CNCF definition, the principles of a cloud native application (microser...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!