What are the most common Terraform interview questions?
Most interviews cover the same core: what Terraform is and how it differs from configuration tools, the init, plan and apply workflow, what state is and why remote state needs locking, count vs for_each, modules and version pinning, variables and outputs, and how to handle drift. Senior and DevOps interviews add CI/CD, secrets, import and refactoring with moved blocks, testing, and scenario questions about broken state or risky plans.
What are Terraform scenario based interview questions?
Scenario questions describe a situation and ask what you would do: the state file is corrupted, someone changed a resource by hand, the plan wants to replace a production database, a lock is stuck after a cancelled job, or a huge state needs splitting. Interviewers want a calm, ordered answer: stop and look first, protect production, fix the cause with code, and prevent it from happening again.
How should I prepare for a Terraform interview?
Learn the core commands and what each one does to state. Write small stacks by hand: an S3 bucket with the split resources, a VPC with public and private subnets, an IAM role, a remote backend. Then practice explaining trade-offs out loud, such as count vs for_each or workspaces vs separate folders. Finish with scenario questions, since they decide most senior interviews.
Which Terraform version should I study?
Study Terraform 1.x and know which features are recent: moved blocks (1.1), preconditions and postconditions (1.2), import blocks and check blocks (1.5), terraform test (1.6), removed blocks and test mocks (1.7), ephemeral values (1.10), and write-only arguments plus S3 lock files without DynamoDB (1.11). For AWS, most production code still uses provider 5.x, and 6.x adds a region argument to most resources. Check developer.hashicorp.com for the latest release.
What is the difference between Terraform and CloudFormation?
CloudFormation is the AWS infrastructure as code service: it covers AWS only, uses JSON or YAML templates, and AWS stores the state of each stack for you. Terraform works with many providers, including AWS, other clouds and SaaS tools, uses HCL, and you manage the state yourself, usually in S3. Teams that run on more than AWS, or want one tool for cloud, DNS and monitoring, often pick Terraform.
What is OpenTofu, and will interviewers ask about it?
In August 2023, HashiCorp moved Terraform to the Business Source License. OpenTofu is a community fork managed under the Linux Foundation that stays under the open source MPL 2.0 license. It forked from the last open source Terraform code in 2023 and works with most Terraform configurations, though newer features differ between the two. Some interviewers ask about it, mostly to see whether you follow the ecosystem.
Do I need a Terraform certification?
Not usually. HashiCorp offers a Terraform Associate certification, and it can help early in a career or when you are moving into DevOps from another role. Most interviewers care more about whether you can explain state, write a clean module and handle the scenarios on this page.
Can I practice Terraform without an AWS account?
Yes. In OphyAI Coding Practice, the 25 Terraform tasks use the AWS provider 5.x and are checked against each task's written requirements, so you do not need an AWS account and nothing is created in the cloud. On your own machine, terraform fmt and terraform validate also work without cloud credentials after terraform init -backend=false.
What does OphyAI Coding Practice include for Terraform?
Coding Practice has 25 Terraform tasks in Easy, Medium and Hard, covering variables and outputs, storage, networking, compute, IAM and modules, next to 153 algorithm problems in Python and JavaScript. You get hints one at a time and an AI coach that checks your plan and reviews your code. The full library comes with Pro and Premium with no credits per problem, and free accounts get 4 sample problems.
Is OphyAI affiliated with HashiCorp?
No. Terraform is a trademark of HashiCorp, and OphyAI is not affiliated with or endorsed by HashiCorp. The questions, answers and practice tasks here are written by OphyAI.