Day 2 — Terraform Basics, Workflow & Version Constraints

DevOps Enginner
Today’s learning focused on the core concepts of Terraform, its workflow, and why versioning is critical when managing infrastructure at scale.
Terraform uses HCL (HashiCorp Configuration Language), a declarative language where we define the desired state of infrastructure rather than writing procedural scripts.
Terraform Workflow
Terraform follows a simple and reliable workflow:
terraform init – Initializes the project and downloads required providers and plugins
terraform plan – Previews the changes Terraform will make
terraform apply – Applies the changes to create or update resources
This workflow helps avoid unexpected changes and provides visibility before execution.
Terraform Registry & Providers
Terraform interacts with cloud platforms and services through providers, which act as plugins to communicate with target APIs.
Providers are available via the Terraform Registry:
Official
Partner
Community
Common providers include AWS, Azure, and GCP, along with services like Docker, Kubernetes, and Datadog.
Terraform Versions & Why They Matter
By default, Terraform may use the latest version, but newer versions can introduce breaking changes. This can cause existing configurations to fail or behave differently.
To maintain stability, Terraform supports version constraints for both Terraform itself and providers.
Example: Version Constraints
Below is a simple example of defining version constraints in Terraform:
terraform {
required_version = "~> 1.6"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
What this means:
required_version = "~> 1.6"→ Allows Terraform versions1.6.xbut blocks1.7+version = "~> 5.0"→ Allows AWS provider versions5.xbut blocks6.0+
This ensures your configuration remains compatible, predictable, and safe across environments.
Getting Started with AWS
Finally, I explored the basics of configuring Terraform with AWS, including setting up credentials and defining the AWS provider to provision cloud resources.
For more detail watch this:- https://youtu.be/JFiMmaktnuM?si=rwDLT-reuhCdZEPw
Github link:- https://github.com/sidharthhhh/terraform




