What is Infrastructure as Code (IaC)? What is Terraform's core workflow?
Infrastructure as Code (IaC)
Describing and managing infrastructure using code, replacing manual clicks in cloud consoles.
Core benefits:
- Version control: Infrastructure changes are reviewable and reversible (Git history)
- Repeatability: The same code produces consistent results across environments (dev/staging/prod)
- Automation: Integrates with CI/CD to keep infrastructure changes in sync with application changes
- Documentation: Code is documentation — clearly describes the current architecture
Core Terraform Concepts
Provider: API integration for cloud platforms (aws, google, azure)
Resource: Actual cloud resources being created (EC2, S3 bucket, VPC)
State: A file that tracks the state of created resources (terraform.tfstate)
Module: Reusable combinations of resources
Core Workflow
terraform init # Download providers, initialize backend terraform plan # Preview changes to be made (dry run) terraform apply # Actually create/modify resources terraform destroy # Destroy all resources
Declarative vs Imperative
Terraform uses a declarative style: you describe the "desired end state," not "how to get there." Terraform calculates the diff and determines execution order.
✦ AI Mock Interview
Type your answer and get instant AI feedback
Sign in to use AI scoring
