Top 30+ Terraform Interview Questions

Terraform is an Infrastructure as code tool developed by Hashicorp. It has the ability to connect with the cloud providers like AWS, GCP, and AZURE. In this blog post, you will see the Top 30 Terraform Interview questions asked at Beginners and Advanced Levels. All the questions are framed with AWS. The same can be expected either with GCP or AZURE.

Beginners Level

  1. What is the role of Terraform in automating the infrastructure deployments?
  2. Give an example of how will you automate the Infrastructure in Terraform?
  3. What is the difference between Infrastructure as a Service and Infrastructure as a Code?
  4. What is the difference between a provider and a resource in Terraform?
  5. What information a state file contains?
  6. What is the difference between current and desired state information?
  7. Where does the current and desired state information is maintained?
  8. Give one example of a variable in Terraform? Explain the usage of variables?
  9. What is the difference between Locals and Variable?
  10. How Terraform is different compared to Ansible?
  11. When to use count and count index?
  12. What are the steps involved in deploying a resource from Terraform?
  13. If your infrastructure is on AWS, then in what scenario you will choose Terraform compared to AWS Cloudformation?
  14. What is Terraform Configuration Language?
  15. What is the difference between Terraform Plan and Terraform Apply commands?
  16. What are Locals in the Hashicorp configuration language?
  17. How do you output a resource configuration from Terraform?
  18. How to apply rollback in Terraform?
  19. What is the significance of “plugins” in the terminology of Terraform? Which plugins did you use in the project?
  20. How to upgrade a Terraform Plugin?
  21. How do you accommodate changes in the state file if multiple people want to work on the same file?
  22. How to apply locks for a state file?
  23. In how many ways, a resource can be destroyed?
  24. How do you activate a third-party provider?
  25. If a change is done manually after the deployment from Terraform, how Terraform manages it in the next run?
  26. What command is used to display the contents of a state file?
  27. How to log the output of a terraform plan or apply command to a text file for further debugging purpose?

Advanced Level

  1. Explain how Modules are used in Terraform?
  2. What is a provisioner in Terraform? Explain briefly how do you implement remote-exe and local-exec provisioner?
  3. What is the difference between an attribute and a variable?
  4. Explain about Terraform Workspace?
  5. Let’s say we have created few resources in Terraform, Now we need to update the resources with few modifications, How do you achieve this Terraform?
  6. What is the significance of Tainting the resource

I hope these questions helped you to get an overview of the questions asked. Please comment below if you are interested to know the answers as well.

Leave a Comment