Infrastructure as Code (IaC) with Terraform
Drill 18 practice questions focused entirely on Infrastructure as Code (IaC) with Terraform for the HashiCorp Terraform Associate exam. Tap an answer for instant feedback and a full explanation — no sign-up, always free.
A DevOps engineer writes Terraform configuration to provision three EC2 instances. After running 'terraform apply' successfully, a teammate runs 'terraform apply' again without changing any code or infrastructure. What behavior should the engineer expect, and which IaC principle explains it?
A new team member argues that Terraform configurations should list the exact sequence of API calls needed to build infrastructure, similar to a shell script. A senior engineer explains that Terraform does not work this way. Which statement best describes how Terraform's approach differs from the shell-script method the new member described?
A development team currently spins up identical staging environments by hand each time a new feature branch needs testing. This process takes several hours, and engineers often forget individual configuration steps, leading to environments that behave differently from one another. The team lead wants to adopt Infrastructure as Code specifically to solve the problem of recreating the same environment quickly and reliably on demand. Which IaC advantage most directly addresses this goal?
A platform engineering team currently provisions infrastructure by having individual engineers run shell scripts from their laptops. Changes are frequently applied without any peer review, and the team struggles to understand who changed what and why. Leadership wants to adopt Infrastructure as Code specifically to improve how proposed infrastructure changes are reviewed and discussed before they take effect. Which advantage of IaC most directly addresses this goal?
A platform team manually patches a production web server's firewall rules during an incident, bypassing the Terraform configuration that originally provisioned it. Weeks later, a developer runs `terraform plan` against that infrastructure. Which advantage of Infrastructure as Code most directly helps the team identify this out-of-band change?
A development team repeatedly encounters bugs that appear only in production but cannot be reproduced in their staging environment. Investigation reveals that staging was built by one engineer clicking through the cloud console, while production was set up months earlier by a different engineer using slightly different settings. Which core advantage of Infrastructure as Code most directly addresses this problem?
A finance team complains that cloud spending is unpredictable because operations engineers provision resources ad hoc through cloud consoles, and no one can forecast costs before changes are applied. The engineering lead wants to adopt Infrastructure as Code specifically to help address this concern. Beyond the raw cost tooling, which inherent characteristic of a declarative IaC workflow BEST helps the team review the exact set of resource changes before they are provisioned?
A new engineer on your platform team asks how Terraform decides what actions to take during an apply. Your team writes configuration files that describe the final set of resources they want (three servers, one load balancer, one database) without listing the individual API calls or ordering steps needed to build them. Which characteristic of Terraform's declarative model best explains how this works?
A company's primary data center suffers a catastrophic failure, destroying all running infrastructure. The operations team needs to rebuild the entire environment in a secondary region as quickly as possible. Their infrastructure is fully defined in Terraform configuration files stored in a Git repository. Which advantage of Infrastructure as Code most directly enables the team to recreate this environment reliably?
A new engineer joins your team and inherits an environment provisioned by a 600-line Bash script that runs a sequence of cloud CLI commands to create servers, networks, and load balancers. The engineer struggles to understand the current state of the infrastructure because the script only describes the steps to build it, not the end result. Which characteristic of the imperative approach used in this script is the primary source of the engineer's difficulty?
A small operations team currently provisions cloud environments by hand, following a lengthy wiki runbook. Each new environment (dev, staging, prod) is supposed to be identical, but the team repeatedly finds subtle differences—an unopened firewall port here, a mismatched instance size there—that cause bugs to appear in production but not in staging. Management asks how adopting Infrastructure as Code would most directly address this specific problem. What is the best answer?
Your organization runs production workloads on AWS but is acquiring a company whose systems all run on Microsoft Azure. Leadership wants the combined infrastructure teams to use one tool and one workflow to provision resources across both clouds, rather than maintaining separate cloud-native scripting for each. Which characteristic of Terraform most directly addresses this requirement?
A platform team currently manages AWS infrastructure with a mix of shell scripts and AWS CLI commands. Leadership announces the company will adopt Azure for a new product line and may later use Google Cloud. The team wants to avoid learning and maintaining a completely separate scripting toolchain for each cloud. Which characteristic of Terraform as an IaC tool most directly addresses this concern?
A startup's operations team currently provisions each new customer environment by clicking through the cloud console, a process that takes an engineer roughly two days per environment. Onboarding demand has spiked, and leadership wants to provision dozens of identical environments per week without proportionally growing the team. Which advantage of adopting Infrastructure as Code most directly addresses this business need?
A new engineer joins a team that manages its entire cloud footprint with Terraform. On their first day, they need to understand exactly what resources exist, how they are configured, and how components relate to each other. There is no separate architecture wiki. Which advantage of Infrastructure as Code best helps the new engineer answer these questions?
Your operations team currently provisions servers by having engineers manually click through a cloud provider's web console. Each engineer configures resources slightly differently, and when an outage occurs, no one can determine what changed or who changed it. Leadership asks you to adopt Infrastructure as Code to solve these problems. Which combination of IaC advantages MOST directly addresses these specific pain points?
A platform team manages all their cloud infrastructure using Terraform configuration files stored in a Git repository. A recent change to a network security group configuration caused an unexpected outage in production. The team needs to quickly return the infrastructure to its previous working configuration and understand exactly what changed. Which advantage of Infrastructure as Code most directly enables them to do this?
Your company runs production workloads on AWS but is acquiring a startup whose systems run entirely on Google Cloud. Leadership wants a single team to manage both environments using one consistent tooling and workflow, while avoiding being locked into vendor-specific provisioning tools like AWS CloudFormation. Which characteristic of Terraform best addresses this requirement?
More Terraform Associate practice
Keep going with the other HashiCorp Certified: Terraform Associate (004) domains, or take a full timed mock exam.
← Back to Terraform Associate overview