📌 Overview of the DevOps Interview Process: From Application to Selection — Part 6 — Terraform 📌

Prashant Lakhera
4 min readMay 20, 2024


What is Terraform?

Terraform is an open-source infrastructure as code (IaC) software tool created by HashiCorp. It allows users to define and provision infrastructure using a high-level configuration language known as HashiCorp Configuration Language (HCL) or, optionally, JSON/YAML. Terraform manages external resources (such as public cloud infrastructure, private cloud infrastructure, network appliances, software as a service (SaaS) products, and more) with a declarative approach, asserting the system’s desired state. This is distinct from an imperative approach, where commands are issued to change the system’s state.

Terraform uses providers to interact with various infrastructure services (like AWS, Microsoft Azure, Google Cloud Platform, and others). Through these providers, Terraform makes API calls to the services to manage the lifecycle of resources such as virtual machines, networks, storage, and more. Terraform configurations are written in files with the .tf extension.

Key Features of Terraform include:

● Infrastructure as Code (IaC): Infrastructure is defined using a high-level configuration syntax, allowing for the creation of a blueprint of data center infrastructure that can be versioned and reused.

● Execution Plans: Terraform generates an execution plan. This shows what it will do when you call terraform apply, giving you a chance to review before making any changes to your infrastructure.

● Resource Graph: Terraform builds a graph of all your resources, enabling it to identify the dependencies between resources and parallelize the creation and destruction of non-dependent resources.

● Change Automation: With the execution plan and resource graph, Terraform can automate changes with minimal human interaction, reducing the potential for human error.

● State Management: Terraform maintains a state file that maps real-world resources to your configuration, keeping track of metadata and improving performance for large infrastructures.

By allowing infrastructure to be expressed as code, Terraform enables infrastructure management practices that are consistent, reproducible, and more efficient than traditional approaches.

What to expect in the Terraform Interview?

For senior candidates, interviews focusing on Terraform often explore the candidate’s depth of understanding regarding infrastructure as code (IaC) concepts, proficiency with Terraform’s syntax and features, and ability to design, manage, and troubleshoot infrastructure deployments. These discussions can cover a wide range of basic to advanced topics to gauge a candidate’s expertise and experience with Terraform and its application in real-world scenarios.

  • Basic Understanding and Setup

Candidates might be asked about Terraform’s foundational principles, including its role in automating infrastructure deployment through code. Questions could cover Terraform’s basic commands (init, plan, apply, destroy), the purpose of the Terraform state file, and how Terraform compares to other IaC tools like AWS CloudFormation or Ansible. Interviewers might also inquire about setting up and configuring Terraform, understanding provider plugins, and the significance of versioning in Terraform files.

  • Terraform Syntax and Constructs

An in-depth discussion on Terraform’s syntax and constructs helps interviewers assess a candidate’s capability to write and interpret Terraform configurations. This includes understanding resources, data sources, variables, outputs, and modules. Candidates may be asked to explain how they would structure Terraform code for modularity and reusability or how they manage variables for different environments (e.g., staging vs. production).

  • State Management and Operations

Interviews often delve into Terraform state management, exploring topics like state locking, remote state storage (e.g., using AWS S3 with state locking via DynamoDB), and strategies for state backup and restoration. Questions may also cover Terraform’s execution plan, understanding how Terraform creates a plan, and the importance of reviewing this plan before applying changes.

  • Advanced Features and Best Practices

Candidates might be asked about advanced Terraform features, such as dynamic blocks, conditional expressions, and loop constructs (e.g., count, for_each). Discussions also cover best practices for writing maintainable and scalable Terraform code, including the use of workspaces for managing different environments, leveraging modules from theTerraform Registry, and adhering to naming and formatting conventions.

  • Complex Scenarios and Troubleshooting

To assess problem-solving skills, interviews can present complex scenarios that require designing multi-tier applications or integrating Terraform with continuous integration/continuous deployment (CI/CD) pipelines. Candidates might be asked how they approach debugging Terraform errors, managing dependencies between resources, or performing blue-green deployments with minimal downtime.

  • Security and Compliance

Given the critical importance of security and compliance, candidates may be questioned on how they use Terraform to enforce security best practices, manage sensitive data (e.g., using Terraform Vault provider), and ensure compliance with organizational policies and industry standards.


By exploring these areas, interviews aim to uncover a candidate’s technical proficiency with Terraform, their approach to infrastructure management, and their ability to leverage Terraform’s capabilities to build, change, and version infrastructure safely and efficiently.

The discussions help identify candidates who are skilled in using Terraform and understand the best practices and strategies for successful infrastructure as code implementations.



Prashant Lakhera

AWS Community Builder, Ex-Redhat, Author, Blogger, YouTuber, RHCA, RHCDS, RHCE, Docker Certified,4XAWS, CCNA, MCP, Certified Jenkins, Terraform Certified, 1XGCP