Task 1: Install Terraform
Follow the official Terraform installation guide for your OS.
After installation, run:
terraform -v
to verify the version.
Task 2: Q&A
Why do we use Terraform?
• Terraform automates infrastructure provisioning and management.
• It helps achieve consistency across environments.
• Makes deployments reproducible, version-controlled, and scalable.
• Works across multiple cloud providers (AWS, Azure, GCP, etc.).What is Infrastructure as Code (IaC)?
• IaC is the practice of managing and provisioning infrastructure using code instead of manual processes.
• With IaC, infrastructure is version-controlled (like application code), ensuring traceability, repeatability, and automation.What is a Resource?
• A resource is a single infrastructure component defined in Terraform configuration.
• Example: an AWS EC2 instance, S3 bucket, or VPC.
• Each resource is declared in .tf files with parameters and configurations.What is a Provider?
• A provider is a plugin that Terraform uses to interact with APIs of cloud platforms or services.
• Examples: aws, azurerm, google, kubernetes.
• Providers authenticate Terraform with the platform and allow it to create resources.What is State file in Terraform? What’s the importance of it?
• Terraform uses a state file (terraform.tfstate) to keep track of infrastructure it manages.
• Importance:
• Acts as the “source of truth” for Terraform.
• Maps real-world resources to your configuration files.
• Allows Terraform to detect changes (drift) and update only what’s necessary.
• Enables collaboration when stored remotely (e.g., in S3 with locking).What is Desired and Current State?
• Desired State: The infrastructure configuration you define in .tf files (your intention).
• Current State: The actual infrastructure that exists, recorded in the state file.
• Terraform compares these two and applies changes to make the current state match the desired state.
Top comments (0)