gitGood.dev

Terraform Interview Questions

Practice Infrastructure as Code concepts with Terraform questions covering HCL, state management, modules, providers, and best practices.

35
Total Questions
9
Easy
21
Medium
5
Hard
Showing 1-20 of 35 questionsPage 1 of 2
Sign up to start practicing these questionsSign up free →
Terraform State Management
QuizMedium
Terraform Modules
QuizMedium
Terraform CI/CD Workflow
QuizMedium
Terraform Environment Management
QuizHard
Importing Existing Infrastructure
QuizMedium
Terraform Data Sources
QuizEasy
Count vs For_each
QuizMedium
Terraform Secrets Management
QuizMedium
Terraform Lifecycle Rules
QuizHard
Multi-Region Terraform
QuizHard
Terraform State Refactoring
QuizHard
Terraform Output and Remote State
QuizMedium
Terraform Dynamic Blocks
QuizMedium
Terraform Version Constraints
QuizEasy
What is Terraform?
QuizEasy
Terraform State Basics
QuizEasy
Resources vs Data Sources
QuizEasy
Terraform State Locking
QuizMedium
Terraform Module Versioning
QuizMedium
Terraform Data Sources vs Resources
QuizEasy

Frequently Asked Questions

What Terraform topics are commonly tested in interviews?

Key topics include HCL syntax, state management (remote backends, state locking), modules and reusability, providers, resource dependencies, data sources, variables and outputs, workspaces, and lifecycle rules. Understanding terraform plan/apply workflow is essential.

How important is Terraform for DevOps interviews?

Very important. Terraform is the most widely adopted IaC tool. DevOps and cloud engineering interviews frequently test your ability to write Terraform configurations, manage state safely, structure modules, and implement CI/CD pipelines for infrastructure changes.

How does Terraform state work?

Terraform state tracks the mapping between your configuration and real infrastructure. It is stored in a state file (terraform.tfstate). Remote backends (S3, Terraform Cloud) enable team collaboration. State locking prevents concurrent modifications. Never edit state files manually - use terraform state commands.

What are Terraform modules and why should I use them?

Modules are reusable packages of Terraform configuration. They promote DRY principles, enforce standards, and simplify complex infrastructure. Use modules for repeated patterns like VPCs, ECS services, or Lambda functions. The Terraform Registry provides community-maintained modules for common use cases.

What is the difference between terraform plan and terraform apply?

Plan shows what changes Terraform will make without modifying infrastructure - it is a dry run. Apply executes the changes. Always review plan output before applying. In CI/CD, save the plan output and apply that exact plan to prevent unexpected changes between plan and apply.

How do I handle secrets in Terraform?

Never store secrets in Terraform code or state in plain text. Use environment variables, AWS Secrets Manager, HashiCorp Vault, or encrypted S3 backends. Mark sensitive variables with sensitive = true. Use data sources to fetch secrets at plan time rather than hardcoding them.

Explore Other Categories