HashiCorp Terraform Associate (004) · 13% practice allocation

HashiCorp 004: Infrastructure as Code (IaC) with Terraform Practice Questions

5 free sample questions from the Infrastructure as Code (IaC) with Terraform domain, with answers and explanations. The full 004 bank has 282 questions across 8 domains. Questions are scenario-based and written from the official HashiCorp exam guide.

1.

Which THREE of the following are characteristics that distinguish Terraform Enterprise from HCP Terraform? (Select THREE)

  • A. Terraform Enterprise is deployed in the customer's own environment (on-premises or private cloud), giving the organization full control over the infrastructure.✓ Correct
  • B. Terraform Enterprise supports a private module registry, whereas HCP Terraform does not offer any module registry.
  • C. Terraform Enterprise is designed for enterprises with requirements such as air-gapped deployments, custom SAML SSO integration, and audit logging beyond what is available on HCP Terraform's free and standard tiers.✓ Correct
  • D. Terraform Enterprise allows organizations to define their own data residency and retention policies, which is critical for regulatory compliance in certain industries.
  • E. Terraform Enterprise includes the Terraform CLI binary, which is not available with HCP Terraform.
  • F. Terraform Enterprise provides a self-hosted option, meaning the organization is responsible for installation, upgrades, and operational maintenance of the platform.✓ Correct
Explanation

Options A, C, and F are correct. Terraform Enterprise (TFE) is self-hosted (A), supports advanced enterprise requirements like air-gapped deployments and extended audit capabilities (C), and places the operational burden of installation and maintenance on the customer's team (F). Option B is false; HCP Terraform also provides a private module registry. Option D is partially true in practice but is not a distinguishing feature listed in HashiCorp's official differentiation — data residency is primarily addressed by self-hosting (already covered by A), and HCP Terraform Business also offers some data handling controls. Option E is false; the Terraform CLI is a separate open-source binary available to all users regardless of whether they use Cloud or Enterprise.

2.

A team is evaluating Terraform against Pulumi for a new project. A colleague claims, 'Pulumi and Terraform are identical because they both provision cloud infrastructure.' Which THREE statements accurately distinguish Terraform from Pulumi?

  • A. Terraform uses HashiCorp Configuration Language (HCL) or JSON as its primary configuration syntax, while Pulumi allows configurations to be written in general-purpose languages such as Python, TypeScript, and Go.✓ Correct
  • B. Terraform providers and Pulumi providers are interchangeable; a Terraform AWS provider can be used directly in a Pulumi project.
  • C. Terraform follows a declarative model where users define desired state, while Pulumi follows an imperative programming model where users write code that calls provider APIs step by step.
  • D. Terraform maintains a state file to track managed resources, while Pulumi also maintains state but stores it in its own backend (Pulumi Cloud or a self-managed backend) by default.✓ Correct
  • E. Terraform is limited to HashiCorp-owned cloud providers, while Pulumi supports any cloud through its open marketplace.
  • F. Both Terraform and Pulumi can use a plan/preview step before applying changes, allowing operators to review proposed changes before execution.✓ Correct
Explanation

Correct (A, D, F): (A) is correct — Terraform's primary language is HCL (or JSON), which is a declarative DSL, while Pulumi lets you write infrastructure code in familiar general-purpose languages like TypeScript, Python, Go, and C#. (D) is correct — both tools maintain state, but Terraform uses a terraform.tfstate file (local or in a remote backend like S3/HCP Terraform), while Pulumi uses its own Pulumi Cloud service or a supported self-managed backend. (F) is correct — both tools have a preview/plan step: terraform plan in Terraform and pulumi preview in Pulumi, both of which show proposed changes before execution. (B) is wrong — Terraform and Pulumi providers are completely separate ecosystems and are NOT interchangeable; Pulumi has its own provider bindings and recently added a Terraform bridge, but they are not directly compatible. (C) is wrong — both Terraform and Pulumi are fundamentally declarative in their resource graph model; Pulumi uses general-purpose language syntax but still builds a declarative resource graph under the hood, not a pure step-by-step imperative execution. (E) is wrong — Terraform supports hundreds of providers across many clouds and services through its open Registry; it is not limited to HashiCorp-owned clouds.

3.

A platform engineer is browsing the Terraform Registry to find a provider for a niche SaaS monitoring tool. The provider is listed with a community tier label. What does this designation indicate?

  • A. The provider is developed and maintained by individual contributors or the community, and HashiCorp does not provide support for it.✓ Correct
  • B. The provider is developed and maintained by the technology partner (the SaaS vendor itself) and meets HashiCorp's partner program requirements.
  • C. The provider is developed and officially supported by HashiCorp and undergoes the same quality standards as the AWS or Azure providers.
  • D. The provider has been deprecated and should not be used in production environments.
Explanation

Correct (A): The Terraform Registry has three provider tiers — Official (built by HashiCorp), Partner (built by technology partners who have joined HashiCorp's partner program), and Community (built by individual contributors or organizations outside the partner program). Community providers are not supported by HashiCorp, and users rely on the community for bug fixes and updates. (C) is wrong — that describes an Official provider, which carries the HashiCorp logo and is maintained by HashiCorp. (B) is wrong — that describes a Partner provider, which is built by the SaaS vendor/technology company and carries a partner badge. (D) is wrong — community tier is an active classification, not a deprecation label; deprecated providers would be explicitly marked as such.

4.

A team has a Terraform root module that uses three provider blocks: aws, azurerm, and github. After a reorganization, the team removes the github provider block and all associated resources from the configuration, then runs terraform apply. Which TWO statements MOST accurately describe what happens? (Select TWO)

  • A. Terraform will update the state file to remove references to the destroyed github resources after a successful apply.✓ Correct
  • B. Removing a provider block without removing its resources from the configuration will cause terraform apply to fail with a validation error before any changes are made.
  • C. Terraform will ignore the removed github resources because providers can only be removed by running terraform destroy first.
  • D. Terraform will automatically migrate the github resources to the aws provider as the default fallback.
  • E. Terraform will destroy all resources previously managed by the github provider that are tracked in the state file.✓ Correct
Explanation

Options A and E are correct. When resources managed by a provider are removed from the configuration, Terraform treats them as resources to be destroyed. On apply, Terraform will destroy those resources and then update the state file to remove their entries. Option C is false; terraform destroy is not required first — removing resources from configuration and running apply is the standard workflow for decommissioning managed resources. Option B describes a real scenario only if the provider block is removed while resource blocks referencing it still exist; in this question, both the provider and its resources are removed, which is valid configuration. Option D is completely false; Terraform has no concept of a default fallback provider — each resource must explicitly reference a provider.

5.

A cloud engineer is explaining Infrastructure as Code to a new team member. Which statement BEST describes the declarative approach that Terraform uses?

  • A. You write scripts in a general-purpose programming language such as Python, and Terraform executes them against the cloud API.
  • B. You define infrastructure resources in a GUI, and Terraform converts them into configuration files automatically.
  • C. You write step-by-step instructions that tell Terraform exactly how to create each resource in the correct order.
  • D. You describe the desired end state of your infrastructure, and Terraform determines the steps required to achieve that state.✓ Correct
Explanation

Correct (D): Terraform uses a declarative model — you specify what you want (the desired end state), and Terraform's planning engine figures out how to get there by comparing the current state to the desired state. (C) is wrong because that describes an imperative approach (e.g., shell scripts or Ansible playbooks in procedural mode), where you define the sequence of actions rather than the goal. (A) is wrong because Terraform uses its own domain-specific language (HCL) or JSON, not general-purpose languages like Python; that description fits Pulumi. (B) is wrong because Terraform has no GUI-to-code conversion feature; it operates entirely on text-based configuration files.

Test yourself across every 004 domain

The free 004 practice test mixes about 20 questions weighted like the exam. The full 282-question bank adds instant grading, flashcards and a timed mock exam.

Study this domain

Infrastructure as Code (IaC) with Terraform study guide (004) →

Other 004 domains

← All HashiCorp Terraform Associate study resources