1. What is Terraform primarily used for?
A) Container orchestration
B) Infrastructure as Code
C) Monitoring systems
D) CI/CD pipelines
Answer: B
2. Terraform configuration files use which language?
A) YAML
B) JSON
C) HCL
D) Python
Answer: C
3. What command initializes a Terraform working directory?
A) terraform start
B) terraform init
C) terraform create
D) terraform plan
Answer: B
4. Which command shows execution plan without applying changes?
A) terraform apply
B) terraform validate
C) terraform plan
D) terraform show
Answer: C
5. What file stores Terraform state by default?
A) terraform.config
B) terraform.tfvars
C) terraform.state
D) terraform.tfstate
Answer: D
6. Which block defines infrastructure resources?
A) provider
B) variable
C) resource
D) output
Answer: C
7. What does terraform apply do?
A) Deletes infrastructure
B) Applies planned changes
C) Validates syntax
D) Downloads providers
Answer: B
8. What is a provider in Terraform?
A) Cloud account
B) API integration plugin
C) Variable file
D) Module template
Answer: B
9. Which command validates Terraform configuration syntax?
A) terraform fmt
B) terraform validate
C) terraform check
D) terraform verify
Answer: B
10. Which file is used to define variable values?
A) terraform.auto
B) variables.tfstate
C) terraform.tfvars
D) main.vars
Answer: C
11. What does terraform destroy do?
A) Removes state file only
B) Deletes infrastructure managed by Terraform
C) Clears cache
D) Removes providers
Answer: B
12. Which block is used to output values?
A) result
B) export
C) output
D) value
Answer: C
13. Which meta-argument creates multiple resource instances?
A) count
B) repeat
C) number
D) copy
Answer: A
14. Which file extension is used for Terraform files?
A) .yaml
B) .tf
C) .json
D) .iac
Answer: B
15. What does terraform fmt do?
A) Formats configuration files
B) Fixes errors
C) Runs plan
D) Upgrades providers
Answer: A
16. What is Terraform state used for?
A) Store passwords
B) Track infrastructure
C) Backup servers
D) Define providers
Answer: B
17. Which backend stores state remotely?
A) local
B) remote
C) cloud
D) All of the above
Answer: D
18. Which block defines reusable infrastructure?
A) module
B) resource
C) provider
D) backend
Answer: A
19. Which command shows current state?
A) terraform list
B) terraform show
C) terraform display
D) terraform state
Answer: B
20. Variables are defined using which block?
A) input
B) config
C) variable
D) var
Answer: C
21. Which command downloads provider plugins?
A) terraform install
B) terraform init
C) terraform get
D) terraform fetch
Answer: B
22. What does terraform refresh do?
A) Updates state with real infrastructure
B) Restarts Terraform
C) Reloads config
D) Formats code
Answer: A
23. What is the default dependency behavior?
A) Manual
B) Automatic based on references
C) Random
D) Sequential only
Answer: B
24. What function references variable values?
A) var.name
B) variable.name
C) input.name
D) value.name
Answer: A
25. Which argument prevents accidental deletion?
A) protect = true
B) lifecycle prevent_destroy
C) secure = yes
D) delete = false
Answer: B
26. Terraform supports which cloud providers?
A) AWS
B) Azure
C) GCP
D) All of the above
Answer: D
27. Terraform is:
A) Mutable infrastructure tool
B) Immutable infrastructure tool
C) Monitoring tool
D) Ticketing system
Answer: B
28. What command lists resources in state?
A) terraform state list
B) terraform list
C) terraform show list
D) terraform resources
Answer: A
29. Which block configures backend settings?
A) provider
B) terraform
C) backend
D) state
Answer: C
30. What happens if state is deleted accidentally?
A) Infrastructure deleted
B) Terraform loses tracking
C) Providers removed
D) Config erased
Answer: B
Conclusion.
If you completed this Ultimate Terraform Basics Quiz (30 Questions) — great job!
Mastering the fundamentals of Terraform is the first major step toward becoming confident with Infrastructure as Code. Understanding core concepts like providers, state files, modules, variables, and lifecycle rules builds the foundation you need for real-world DevOps projects.
Whether you’re:
- Preparing for a certification from HashiCorp
- Getting ready for a DevOps interview
- Managing cloud infrastructure professionally
- Or just starting your IaC journey
Consistent practice is the key.
If your score wasn’t where you wanted it to be don’t worry. Review the questions you missed, experiment with hands-on labs, and run Terraform commands in a test environment. Practical experience reinforces theory faster than anything else.
What’s Next?
- Try an intermediate-level Terraform quiz
- Practice real deployment scenarios
- Explore modules and remote backends
- Build a small multi-environment project (dev/staging/prod)
Keep learning, keep building, and keep automating.
Your Infrastructure as Code journey is just getting started.
- If you want to explore Terraform, start your training here.



