1031 words
5 minutes

10 Terraform Interview Questions You Must Know in 2025

By · Developer Advocate · Docker Captain · IBM Champion
Flat-lay corner of a marble desk with the edge of a silver MacBook keyboard, a polaroid of a pineapple in a turquoise pool, a glass terrarium, and sunglasses

So you’ve got a Cloud Engineer or DevOps Engineer interview lined up in 2025. Darling, you must know Terraform. It’s one of the most in-demand tools out there for managing cloud infrastructure, and interviewers love asking about it.

Here are 10 must-know Terraform interview questions to help you land your next DevOps job! Real tips, real-world examples, the good stuff. 💪

Question 1: What is Terraform and why should you care?#

Terraform is a free tool made by HashiCorp. It lets you manage your cloud infrastructure (servers, databases, networks) using code instead of clicking around in a user interface like the AWS console.

You write some config files. Terraform reads them and builds all your resources for you. That’s the whole idea.

Why it’s useful:

  • You stop doing things manually. No more clicking the same buttons forever.
  • Your environments stay consistent across dev, test, and prod.
  • It works with multiple cloud providers like AWS, Azure, and Google Cloud Platform.

Example: Need 5 EC2 instances in AWS? Setting them up one by one is a pain. Write a Terraform script instead, and it spins everything up in one go.

🚀 Pro Tip: Someone might ask how Terraform differs from tools like Ansible or CloudFormation. Easy answer, sis: Terraform describes the end goal, meaning what you want things to look like, while Ansible focuses more on the step-by-step process of getting there.

Question 2: What are the main parts of Terraform?#

Three pieces. Know them cold.

  • Providers connect Terraform to cloud platforms like AWS, Azure, GCP, and so on.
  • Modules are chunks of reusable code that keep you from repeating yourself everywhere.
  • State is a file that tracks what Terraform has already created.

Example: Say you’re spinning up a server on AWS. The provider tells Terraform, “Hey, we’re using AWS,” and then a module can handle the networking, storage, and the rest of it for you.

Question 3: What is Terraform State and why is it important?#

Terraform State is just a file. It remembers everything Terraform has built.

Why does it matter so much? A few reasons.

  • It keeps track of what already exists in your infrastructure.
  • It works out the relationships, or dependencies, between your resources.
  • It lets your whole team collaborate, especially when the state file lives remotely. That part is huge for team setups.

Here’s where people mess up, queen: they save state on their laptop. One spilled coffee and your entire Terraform tracking is gone. Don’t be that person.

🚀 Pro Tip: Store state in S3 and use DynamoDB for locking, or just go with Terraform Cloud to make life easier. And if someone drops the phrase “state locking” on you, it’s basically just a way to stop multiple people from making changes at the same time.

Question 4: What’s the difference between Terraform Plan and Apply?#

Honestly? Simple.

  • terraform plan shows you what changes Terraform is going to make.
  • terraform apply actually makes those changes.

Example: Say you change an EC2 instance type from t2.micro to t3.micro. terraform plan will say, “Hey, this is the difference,” and terraform apply will go ahead and make it happen.

🚀 Pro Tip: Before you apply anything, run terraform plan and save the output to a file. Now you can double-check what’s about to happen. No nasty surprises.

Question 5: How does Terraform handle dependencies?#

Most of the time, Terraform figures out dependencies on its own. It just reads how your resources connect to each other.

But sometimes you need to be explicit. That’s where depends_on comes in. It tells Terraform, “Hey, make sure this thing is done first.”

Example: You’re creating an EC2 instance that needs a VPC. Terraform already knows to build the VPC first.

🚀 Pro Tip: Try not to lean on depends_on too much. Terraform is smart, code cuties. It usually handles this without any extra hand-holding.

Question 6: What is Terraform Drift and how do you find it?#

Drift is when something in your cloud setup changes outside of Terraform. Maybe a coworker made a manual tweak in the AWS Console. Now your code doesn’t match what’s actually running, and that’s a problem.

How do you catch it? Run terraform plan. It’ll flag anything that changed when Terraform wasn’t looking.

🚀 Pro Tip: Want to stay organized and current? Set up automatic drift checks in Terraform Cloud, or add a simple step to your automation setup to check for changes from time to time.

Question 7: How do you handle sensitive data in Terraform?#

Secrets need care. Here’s how to keep them safe.

  • Use variables and set sensitive = true.
  • Store the secrets somewhere actually secure, like AWS Secrets Manager or Vault.
  • Make sure your remote state is encrypted.

🚨 And seriously, never put passwords directly in your code or state files. Ever.

Question 8: What are Terraform Workspaces?#

Workspaces let you use the same Terraform config across different environments like dev, staging, and prod.

🔹 You can run commands like:

  • terraform workspace new dev
  • terraform workspace select dev

🚀 Pro Tip: Workspaces are fine for small projects. But once your system gets bigger, separate state files are usually the smarter call.

Question 9: What are Terraform Modules and why use them?#

Modules are reusable bits of code that make your Terraform setup way easier to manage.

So why bother with them?

  • They stop you from copy-pasting the same code into every project.
  • They keep your files nice and organized.
  • They help your infrastructure stay consistent everywhere.

📌 Example: Build a module for a VPC once, then reuse it in a bunch of places. No rewriting that code over and over.

🚀 Pro Tip: Before you write your own module, check out the Terraform Registry. Someone else may have already built exactly what you need. Work smarter, not harder.

Question 10: How do you use Terraform in an automated deployment process?#

You can plug Terraform into your CI/CD setup using tools like:

  • GitHub Actions
  • GitLab CI
  • Terraform Cloud

🛠 Here’s a basic workflow:

  1. Run terraform fmt and terraform validate to check formatting and syntax.
  2. Use terraform plan to preview the changes.
  3. Only run terraform apply after someone gives the green light. Especially in production.

🚀 Pro Tip: Some teams also use Open Policy Agent to apply security rules before changes go live.


🔥 Alright, that’s a wrap! These 10 Terraform questions should give you a solid foundation for your next DevOps interview.

Thanks for reading! Be sure to watch the video version for extra insights and helpful visuals.


Tatiana Mikhaleva

Docker Captain  ·  IBM Champion  ·  AWS Community Builder

DevOps.Pink — cloud-native education for the agentic-AI era.

Related Posts

Same category
  1. 1
    How to Secure AI Agents in Production: IBM's Six-Phase Framework
    DevOps & Cloud · Teams secure AI agents like normal software, and production breaks. Here's IBM and Anthropic's six-phase framework for securing them, phase by phase.
  2. 2
    Your AI Agent Doesn't Need a Better Prompt. It Needs a Ceiling
    DevOps & Cloud · A prompt is not a security control. It's a wish. The Vault → Sentinel → MCP → ADLC → watsonx Orchestrate stack that gives AI agents a hard ceiling — and why IBM consolidating HashiCorp made the whole thing boring, in the best possible way.
  3. 3
    CNCF Q1 2026 Report — Why Feature Flagging Is the Hidden Gateway to Cloud Native Maturity
    DevOps & Cloud · CNCF Q1 2026 cloud native report analysis. Why feature flagging is the bridge from mainstream to advanced engineering practice, with exclusive commentary from the report's author.
  4. 4
    AI SRE Joined My On-Call — A Beginner-Friendly Walkthrough of Rootly
    DevOps & Cloud · What an AI SRE actually does on call. A hands-on walkthrough of Rootly — how it observes, advises, and (when you let it) acts. With a real look at the four-level trust model.

Random Posts

Random
  1. 1
    DevOps for IT Girls - Deploying Like a Queen
    DevOps & Cloud · Master DevOps the IT Girl Way! Learn Docker, Kubernetes, CI/CD & more in this fun, beginner-friendly guide. Automate & deploy like a pro!
  2. 2
    Inside Helm - How Charts, Releases, and State Work in Kubernetes
    DevOps & Cloud · Learn how Helm really works under the hood — charts, releases, and Kubernetes state management explained in plain DevOps language.
  3. 3
    How to Secure AI Agents in Production: IBM's Six-Phase Framework
    DevOps & Cloud · Teams secure AI agents like normal software, and production breaks. Here's IBM and Anthropic's six-phase framework for securing them, phase by phase.
  4. 4
    Escaping the Command Line Cartel: Why I Mandate Visual Git in Enterprise DX
    DevOps & Cloud · Relying purely on the terminal is a toxic DX dependency. Discover how architecting visual version control with GitKraken eliminates cognitive load, enforces psychological safety, and scales enterprise DevOps.
10 Terraform Interview Questions You Must Know in 2025
https://devops.pink/10-terraform-interview-questions-you-must-know-in-2025/
Author
Tatiana Mikhaleva
Published
2025-04-01
License
CC BY-NC-SA 4.0