Practice Exam: Terraform Associate (004)

Question bank: 100 · timed mock exam: 60 min

Official exam page on the vendor's site (opens in a new tab) Official exam guide (opens in a new tab) Official prep course (opens in a new tab)

  • Terraform configuration 22 questions
  • Core Terraform workflow 20 questions
  • Terraform fundamentals 12 questions
  • Terraform modules 10 questions
  • Terraform state management 10 questions
  • HCP Terraform 10 questions
  • Infrastructure as Code (IaC) with Terraform 8 questions
  • Maintain infrastructure with Terraform 8 questions

Free: 25 questions in study mode, all domains, no account.

Subscription: the 100 questions of this certification, the timed exam mode, and all other certifications too.

Subscribe · €9.99 / month

Secure card payment (Stripe) · No commitment · Cancel online

How to prepare for Terraform Associate with InfraPrep

The 100 questions cover 8 domains: Terraform configuration, Core Terraform workflow, Terraform fundamentals, Terraform modules, Terraform state management, HCP Terraform, Infrastructure as Code (IaC) with Terraform, Maintain infrastructure with Terraform. 25 of them are free, without an account.

Study mode

Answer at your pace: each answer is corrected straight away, with an explanation and the link to the documentation it relies on.

Exam mode

A timed exam of 60 minutes, with a question map to flag and come back to questions before you submit.

Results by domain

Your score is broken down by domain, so you know what to review first.

Original questions

Every question is written from the public documentation, never copied from the exam. You can contest an answer from study mode.

10 free sample questions

Question 1 Infrastructure as Code (IaC) with Terraform

A new engineer switching from an imperative scripting tool to Terraform asks how Terraform's configuration language works. Which statement correctly explains Terraform's Infrastructure as Code approach?

  1. Terraform configuration describes the exact sequence of API calls Terraform must execute, in the order they appear in the files
  2. Terraform configuration is declarative: it describes the intended end state of the infrastructure rather than the steps needed to reach it
  3. Terraform configuration is imperative: each block executes as a command in file order, like a shell script
  4. The order in which resource blocks are written in a file determines the order in which Terraform creates the corresponding infrastructure
Show the answer and the explanation

Correct answer: B

The Terraform language is declarative, describing an intended goal rather than the steps to reach that goal.

Source: official documentation

Question 2 Terraform fundamentals

A team wants to pin the AWS provider to a specific version range and have Terraform install that provider automatically before the first plan. Where should they declare the version constraint, and which command installs the provider?

  1. In a `providers.lock` file that must be created manually before running any Terraform command
  2. Provider versions cannot be constrained; Terraform always installs the latest available version
  3. In `required_providers` with a version constraint; `terraform init` installs the provider
  4. In a `provider "aws" { version = "..." }` block only; running `terraform apply` installs it
Show the answer and the explanation

Correct answer: C

Running terraform init locally installs a provider and updates the dependency lock file with the latest version matching the version string you configured in your required_providers block.

Source: official documentation

Question 3 Core Terraform workflow

An engineer just wrote a brand-new Terraform configuration in an empty directory. Which command must be run first, before `plan` or `apply` will work?

  1. terraform fmt
  2. terraform validate
  3. terraform plan
  4. terraform init
Show the answer and the explanation

Correct answer: D

The terraform init command initializes a working directory containing Terraform configuration files; this is the first command you should run after writing a new Terraform configuration or cloning an existing configuration from version control.

Source: official documentation

Question 4 Terraform configuration

What is the fundamental difference between a `resource` block and a `data` block in a Terraform configuration?

  1. A `data` block can only be used inside modules; it cannot be used in root configurations
  2. `resource` creates infrastructure; `data` only fetches it from the provider
  3. Both blocks create infrastructure; the only difference is naming convention
  4. `resource` reads information; `data` creates infrastructure
Show the answer and the explanation

Correct answer: B

the resource block defines a piece of infrastructure and specifies the settings for Terraform to create it with, while data sources fetch data from the provider, but do not create or modify resources.

Source: official documentation

Question 5 Terraform modules

A platform module accepts a `region` value from whichever root configuration calls it, and that value cannot be seen or reused by unrelated root configurations that don't call the module. Which statement best describes this behavior?

  1. The module's input variables accept values from the calling module, scoping the value to that particular module call
  2. All variables in a Terraform project are global and visible from any module regardless of how modules are called
  3. Variable scope is controlled by the `alias` argument on the module block
  4. Only output values are scoped to a module; input variables are always global
Show the answer and the explanation

Correct answer: A

modules commonly use input variables to accept values from the calling module, and a module may call other modules, connecting them by passing output values from one to input values of another.

Source: official documentation

Question 6 Terraform state management

A configuration has no `backend` block defined at all. Where does Terraform store its state by default, and how?

  1. The local backend is used by default; state is stored as a file on disk
  2. State is kept only in memory and discarded when the CLI process exits
  3. Terraform refuses to run until a backend block is explicitly configured
  4. In HCP Terraform automatically, even without any configuration
Show the answer and the explanation

Correct answer: A

Terraform uses a backend called local by default, and the local backend type stores state as a local file on disk.

Source: official documentation

Question 7 Maintain infrastructure with Terraform

A database was created manually in the cloud console before Terraform was adopted. The team now wants Terraform to manage it going forward without recreating it. What should they do, and what constraint must they respect?

  1. Manually edit the state file's JSON to add the resource, since `terraform import` cannot handle resources created outside Terraform
  2. Add a `data` block pointing at the resource; this automatically starts managing its lifecycle
  3. Run `terraform import` to bring the existing resource under Terraform's management, making sure to bind each remote object to only one resource address
  4. Delete the manually created resource and let `terraform apply` recreate it identically
Show the answer and the explanation

Correct answer: C

the terraform import command imports existing resources into Terraform, and Terraform expects that each remote object it is managing will be bound to only one resource address.

Source: official documentation

Question 8 HCP Terraform

What does HCP Terraform actually do to create infrastructure?

  1. It only stores Terraform state and documentation; it never runs the Terraform CLI itself
  2. It replaces the Terraform CLI entirely with a proprietary provisioning engine
  3. HCP Terraform runs the Terraform CLI to provision infrastructure on demand or in response to events
  4. It can only validate configurations; provisioning must always be triggered from a local Terraform CLI
Show the answer and the explanation

Correct answer: C

HCP Terraform runs the Terraform CLI to provision infrastructure, and it is a platform that uses Terraform to provision and manage infrastructure, either on demand or in response to various events.

Source: official documentation

Question 9 Infrastructure as Code (IaC) with Terraform

A platform team wants to manage resources across AWS, an on-premises VMware cluster, and a SaaS monitoring tool from the same Terraform configuration, using one consistent workflow. What Terraform mechanism makes this multi-cloud, hybrid, and service-agnostic approach possible?

  1. Terraform relies on plugins called providers to interact with cloud, SaaS, and self-hosted platforms
  2. Terraform embeds native SDKs for AWS, VMware, and major SaaS products directly inside the terraform binary
  3. Terraform requires a separate installation of the CLI for each platform it manages
  4. Terraform can only manage multiple platforms if they are all accessed through the same cloud vendor's API gateway
Show the answer and the explanation

Correct answer: A

Terraform relies on plugins called providers to interact with cloud providers, SaaS providers, and other APIs.

Source: official documentation

Question 10 Terraform fundamentals

A configuration must create resources in two different AWS regions using the same AWS provider. How should this be expressed in the provider configuration?

  1. Set the `version` argument twice in the same provider block, once per region
  2. Declare a second `provider "aws"` block with `alias`, then reference it with the `provider` meta-argument
  3. Duplicate the entire configuration into two separate root modules, since one provider block can only ever target one region
  4. Declare two separate `required_providers` blocks, one per region
Show the answer and the explanation

Correct answer: B

alias is a unique identifier for a specific provider configuration, letting you use multiple configurations for the same provider.

Source: official documentation

Frequently asked questions

Are there free questions, and do I need an account?

Yes. 25 questions of this certification are free in study mode, across all its domains, without a subscription and without registration. The account is created when you subscribe, at checkout.

How does the subscription work, and can I cancel?

One monthly subscription covers all certifications and the timed practice exams. There is no minimum period. You cancel online, at any time, with the "Cancel your contract" function in My account; cancellation takes effect at the end of the month already paid, and no further payment is taken.

Where do the questions come from?

Every question is original, written from the vendor's public documentation. Each answer comes with an explanation and a link to the documentation page it relies on. InfraPrep is not affiliated with the vendors, and certification names belong to their owners.

In which language are the questions?

The questions are written in English, also on the French version of the site.

Is the catalog updated?

Yes, the catalog changes over time: new certifications and new questions are added.