Interview Questions & Answers for Terraform

Explain what Terraform is and how does it works

What benefits infrastructure-as-code has?

Why Terraform and not other technologies? (e.g. Ansible, Puppet, CloufFormation)

True or False? Terraform follows the mutable infrastructure paradigm

True or False? Terraform uses declarative style to describe the expected end state

Explain what is “Terraform configuration”

What is HCL?

Explain each of the following:

  • Provider
  • Resource
  • Provisioner

What terraform.tfstate file is used for?

How do you rename an existing resource?

Explain what the following commands do:

  • terraform init
  • terraform plan
  • terraform validate
  • terraform apply

How to write down a variable which changes by an external source or during terraform apply?

Give an example of several Terraform best practices

Explain how implicit and explicit dependencies work in Terraform

What is local-exec and remote-exec in the context of provisioners?

What is a “tainted resource”?

What terraform taint does?

What types of variables are supported in Terraform?

What is a data source? In what scenarios for example would need to use it?

What are output variables and what terraform output does?

Explain Modules

What is the Terraform Registry?

Explain remote-exec and local-exec

Explain “Remote State”. When would you use it and how?

Explain “State Locking”

What is the “Random” provider? What is it used for

How do you test a terraform module?

Aside from .tfvars files or CLI arguments, how can you inject dependencies from other modules?

Rajesh Kumar
Follow me