HashiCorp 004 Multiple choice 57 questions 1 hour

Terraform Associate

Infrastructure as code with Terraform 1.12: providers and state, the core workflow, configuration, modules and HCP Terraform. HashiCorp publishes the objectives but not the question count or weights, so mock exams here use 57 questions spread by the number of objectives in each section.

The blueprint

A mock exam here has 57 questions in 1 hour, split across the domains in the same proportions as the official exam guide. The official pass mark is Not published by HashiCorp. FixOps scores practice against a target of 70%.

  1. 01

    Infrastructure as Code with Terraform

    8%

  2. 02

    Terraform Fundamentals

    11%

  3. 03

    Core Terraform Workflow

    19%

  4. 04

    Terraform Configuration

    22%

  5. 05

    Terraform Modules

    11%

  6. 06

    Terraform State Management

    11%

  7. 07

    Maintain Infrastructure with Terraform

    8%

  8. 08

    HCP Terraform

    10%

Sample questions

Three of the 10 questions in the free diagnostic. Open one to see the answer and why.

Which statement best describes infrastructure as code?
  • Application source code is compiled directly onto the servers it runs on
  • Infrastructure is created by engineers clicking through a cloud console
  • Infrastructure is described in versioned files that a tool applies
  • Servers are documented in a spreadsheet after they have been built by hand

Answer: Infrastructure is described in versioned files that a tool applies. Infrastructure as code means defining infrastructure in machine-readable files that a tool applies, so the definition can be versioned, reviewed and reused. Console clicks and after-the-fact documentation are the manual approach it replaces, and compiling application code is unrelated.

Where does a configuration declare which providers it needs and where to download them from?
  • In a required_providers block inside the terraform block
  • In an environment variable named TF_PROVIDERS
  • In the provider block's version argument only
  • In the terraform.tfstate file

Answer: In a required_providers block inside the terraform block. The required_providers block, nested in the terraform block, gives each provider a local name, a source address and a version constraint. The provider block configures a provider rather than declaring where it comes from, state records what exists, and no such environment variable is used.

What is the main purpose of Terraform state?
  • To cache provider plugins between runs
  • To hold a backup copy of the configuration files
  • To map configured resources to real objects
  • To record which user ran each command

Answer: To map configured resources to real objects. State records which real object each resource instance in the configuration corresponds to, together with its attributes, so Terraform knows what to update or delete. It is not a copy of the configuration, a plugin cache or an audit log.

Revision notes: Infrastructure as Code with Terraform

The notes for one domain, free to read here and in the app. FixOps Pro has them for all 8 domains.

What infrastructure as code is, why it beats manual changes, and what Terraform in particular brings: one workflow for many providers.

Infrastructure as code

  • Infrastructure is described in files that are versioned, reviewed and applied by a tool, instead of being clicked together by hand.
  • The same configuration produces the same infrastructure every time, which makes environments repeatable.
  • Changes are visible in version control: who changed what, when and why.
  • Reviewing a plan before it is applied catches mistakes that a manual change would only reveal afterwards.

Declarative, not imperative

  • Terraform configuration declares the desired end state; Terraform works out the steps to reach it.
  • Applying the same configuration again changes nothing: the operation is idempotent.
  • Terraform builds a dependency graph and creates independent resources in parallel.

Why Terraform

  • Providers let one language and workflow manage many platforms: public clouds, SaaS products and on-premises systems.
  • Multi-cloud and hybrid deployments use the same write, plan, apply workflow.
  • State records what Terraform manages, so it can plan precise changes and detect drift.
  • Modules package configuration for reuse across teams.

Provisioning and configuration

  • Terraform provisions infrastructure; configuration management tools install and configure software on it.
  • Immutable infrastructure replaces resources instead of changing them in place, which avoids configuration drift.
  • Terraform is the open workflow; HCP Terraform adds remote runs, state storage, policy and team features.

Easy to mix up

  • Declarative says what the result should be; imperative says how to get there.
  • Idempotent means a second apply with no changes does nothing.
  • Terraform creates the servers; a configuration management tool sets up what runs on them.
  • Provider-agnostic workflow does not mean one configuration runs on any cloud: resources are still provider-specific.

Practice questions written by FixOps from the public Terraform Associate (004) exam objectives. They are not real exam questions. FixOps is not affiliated with or endorsed by HashiCorp.

Your pager is ready.

Free, instant, and it works on your phone. No signup: start as a guest and save your progress later.