SaveMyCert
Log in
5 of 5 free questions left today·for 30 a day
Terraform 004 · Domain 3

Core Terraform workflow practice questions

Core Terraform workflow is worth 19% of the Terraform 004 exam — the 2nd-heaviest of the 8 domains. The write → init → plan → apply → destroy workflow, plus formatting. Weight approximates the sub-objective share. 6 fully worked examples are further down this page, answers included.

Exam weight
19%
the 2nd-heaviest of the 8 domains
Questions
40
across 2 topics
Free, no account
5/day
sign up free to remove the cap
Explanations
Every option
right and wrong

Build a practice session

5 free questions left today.

Domains

How many?

Mode

Ready when you are

10 fresh questions drawn across 1 of 8 domains, in Learn mode.

Focused review

Every question you answer incorrectly, and every question you flag while practising, is saved here automatically. Finish a session and you can come back to re-drill just those.

6 sample Core Terraform workflow questions, fully explained

Questions from the Terraform 004 bank mapped to domain 3, with the answer key and the reasoning behind every option. None of them repeat the examples on the main Terraform 004 practice page.

Question 1Core Terraform workflow

With respect to providers, what does terraform init do?

Choose one.

  • a
    It publishes the configuration's providers to the Terraform Registry

    init consumes providers from a registry; publishing providers is a separate developer workflow that has nothing to do with init.

  • b
    It downloads the provider plugins the configuration requires, honoring version constraints, into the .terraform directory Correct

    init resolves each required provider against its version constraints, downloads the matching plugin from the registry, and installs it locally under .terraform.

  • c
    It creates the cloud resources declared for each provider

    init never creates infrastructure. Resources are only created by terraform apply.

  • d
    It verifies provider credentials by making a test API call to each provider

    init does not authenticate to providers or call their APIs. Credentials are first exercised when plan or apply talks to the provider.

The concept

Provider installation is one of terraform init's core jobs. Terraform reads the required_providers block, selects versions that satisfy the constraints, downloads the plugins, and records the selections in the dependency lock file.

Why that’s the answer

Providers are executable plugins that Terraform Core does not ship with, so they must be fetched before any other command can use them. init performs that download into the local .terraform directory and writes .terraform.lock.hcl so future runs select identical versions. It does not publish anything, does not create infrastructure, and does not test credentials - those misconceptions confuse init with apply or with provider development workflows.

How to reason it out
  1. Declare providers and version constraints in the required_providers block.
  2. Run terraform init to download matching provider plugins into .terraform.
  3. Check the generated .terraform.lock.hcl into version control so teammates get the same versions.

Exam tip: terraform init downloads and locks provider plugins; it never touches real infrastructure.

Terraform init, validate, and plan: the core workflow explained — the lesson that teaches this.

Question 2Core Terraform workflow

What is the primary purpose of terraform validate?

Choose one.

  • a
    To check that the configuration is syntactically valid and internally consistent, without contacting remote services Correct

    validate confirms HCL syntax and internal consistency, such as attribute names and reference types, and it does not reach out to provider APIs or remote state.

  • b
    To compare the state file with real infrastructure and report drift

    Drift detection is the job of the refresh behavior in plan (for example terraform plan -refresh-only), not validate.

  • c
    To apply pending changes after checking them for errors

    validate never changes infrastructure. Applying changes is what terraform apply does.

  • d
    To rewrite the configuration into the canonical formatting style

    Canonical formatting is terraform fmt's job. validate checks correctness, not style.

The concept

terraform validate is a static check of the configuration in the current working directory. It verifies syntax and internal consistency - valid block structure, known argument names, and correct reference types - using provider schemas installed by init.

Why that’s the answer

validate is deliberately offline: it needs no cloud credentials and makes no remote API calls, which makes it fast and safe to run in CI on every commit. It cannot detect drift because it never looks at state or real infrastructure, it cannot apply anything, and it does not reformat files. Its scope is purely whether the configuration itself is well-formed and coherent.

How to reason it out
  1. Run terraform init once so provider schemas are available locally.
  2. Run terraform validate to check syntax and internal consistency.
  3. Fix any reported errors, then proceed to terraform plan.

Exam tip: validate is an offline correctness check of the configuration - no credentials, no state, no infrastructure.

Terraform init, validate, and plan: the core workflow explained — the lesson that teaches this.

Question 3Core Terraform workflow

Why is terraform plan considered safe to run against production infrastructure?

Choose one.

  • a
    It applies changes but automatically rolls them back afterward

    plan never applies anything, so there is nothing to roll back. Terraform also has no automatic rollback mechanism at all.

  • b
    It locks the infrastructure so no changes can happen while it runs

    Terraform can lock the state file during operations, but it does not lock real infrastructure, and that is not what makes plan safe.

  • c
    It runs entirely offline without reading state or provider APIs

    plan does read state and, by default, refreshes it by querying provider APIs. It is read-only toward infrastructure, not offline.

  • d
    It only reads current state and provider data to produce a preview; it never modifies real infrastructure Correct

    plan computes the difference between configuration and state and prints the proposed actions. Nothing is created, changed, or destroyed until apply.

The concept

terraform plan is the preview step of the core workflow. It refreshes its in-memory view of state, compares the desired configuration with the recorded state, and prints the set of create, update, and destroy actions that an apply would perform.

Why that’s the answer

The safety of plan comes from being read-only with respect to infrastructure: it may query provider APIs to read current attributes, but it never issues create, update, or delete calls. That lets teams run plan freely against production to review pending changes. It is not offline (it reads state and providers), it does not lock infrastructure, and it certainly does not apply-then-rollback.

How to reason it out
  1. Edit the configuration to describe the desired infrastructure.
  2. Run terraform plan and read the proposed actions carefully.
  3. Only after review, run terraform apply to execute the changes.

Exam tip: plan is a read-only preview - it can query providers but never changes infrastructure.

Terraform init, validate, and plan: the core workflow explained — the lesson that teaches this.

Question 4Core Terraform workflow

In terraform plan output, a resource is prefixed with the ~ symbol. What does this indicate?

Choose one.

  • a
    The resource will be updated in place Correct

    The tilde marks an in-place update: Terraform will change one or more arguments on the existing object without destroying it.

  • b
    The resource will be destroyed and recreated

    Destroy-and-recreate (replacement) is shown with -/+ (or +/- with create_before_destroy), not a plain tilde.

  • c
    The resource will be destroyed

    A pure destroy is marked with a - prefix.

  • d
    The resource is new and will be created

    Creation is marked with a + prefix.

The concept

Plan output uses action symbols: + for create, - for destroy, ~ for update in place, and -/+ for replace (destroy then create). Reading these symbols correctly is essential to reviewing a plan before approving it.

Why that’s the answer

The ~ prefix specifically means Terraform can achieve the desired change by modifying the existing remote object - for example changing a tag or an instance's monitoring setting - so the object keeps its identity. This is very different from -/+, which means the change forces replacement and the object will be destroyed and recreated, potentially causing downtime or data loss. Distinguishing the two is a key review skill.

How to reason it out
  1. Run terraform plan after editing configuration.
  2. Scan the action symbols: + create, ~ update in place, - destroy, -/+ replace.
  3. Pay special attention to -/+ lines and the 'forces replacement' annotations before applying.

Exam tip: ~ means update in place; -/+ means destroy and recreate.

Terraform init, validate, and plan: the core workflow explained — the lesson that teaches this.

Question 5Core Terraform workflow

You change the ami argument of an aws_instance resource and run terraform plan. The instance is shown with the -/+ prefix and the ami line is annotated with 'forces replacement'. What will happen on apply?

Choose one.

  • a
    The AMI will be swapped on the running instance without downtime

    An in-place change would be shown with ~. The 'forces replacement' annotation means the provider cannot update this attribute on the existing object.

  • b
    The existing instance will be destroyed and a new instance will be created with the new AMI Correct

    -/+ is the replacement action: the provider cannot change this argument in place, so Terraform destroys the old object and creates a new one.

  • c
    Terraform will refuse to apply until the old instance is manually deleted

    Terraform handles the replacement itself as part of apply; no manual deletion is required.

  • d
    Only the state file will be updated; the real instance is untouched

    A state-only update describes refresh behavior. A -/+ plan performs real destroy and create operations on the infrastructure.

The concept

Some resource arguments are immutable at the provider API level. When such an argument changes, Terraform plans a replacement: destroy the existing object, then create a new one. Plan output marks this with -/+ and annotates the specific argument with 'forces replacement'.

Why that’s the answer

An EC2 instance's AMI cannot be changed on a running instance, so the AWS provider declares ami as a replacement-forcing argument. On apply, Terraform will destroy the current instance and create a replacement booted from the new AMI. Reviewers must catch this in the plan because replacement can mean downtime and loss of instance-local data - which is exactly why plan surfaces the reason next to the changed argument.

How to reason it out
  1. Run terraform plan and look for -/+ prefixes in the output.
  2. Find the argument annotated with 'forces replacement' to see what triggered it.
  3. Decide whether replacement is acceptable (or mitigate with lifecycle settings) before running apply.

Exam tip: 'forces replacement' in a plan means apply will destroy and recreate the resource, not update it.

Terraform init, validate, and plan: the core workflow explained — the lesson that teaches this.

Question 6Core Terraform workflow

A working directory was initialized weeks ago and has been used for many plans. You add a random_pet resource, which is the first use of the hashicorp/random provider in this configuration. terraform plan now fails saying the provider is not installed. What should you do?

Choose one.

  • a
    Run terraform init -reconfigure to reset the backend

    -reconfigure addresses backend configuration changes. The problem here is a missing provider plugin, which plain init already solves.

  • b
    Run terraform validate to register the new provider

    validate checks the configuration; it cannot install provider plugins and would itself complain about the missing provider schema.

  • c
    Delete the state file and run terraform plan again

    Deleting state would orphan all existing infrastructure and does nothing to install the missing plugin. Never delete state to fix an init problem.

  • d
    Run terraform init again so the new provider plugin is downloaded Correct

    init must be re-run whenever the configuration starts requiring a provider (or module, or backend change) that the working directory does not yet have installed.

The concept

terraform init is not a one-time command. It must be re-run whenever the working directory's dependencies change: a new provider is required, a new module is added or a module source changes, or the backend configuration changes.

Why that’s the answer

Adding random_pet makes the configuration depend on the hashicorp/random provider, which was never downloaded during the original init. Re-running terraform init resolves the new requirement, downloads the plugin, and updates the dependency lock file with the selected version. The other options either target the wrong subsystem (backend) or are destructive (deleting state).

How to reason it out
  1. Add the new resource and, ideally, declare the provider in required_providers.
  2. Run terraform init; it downloads only what is newly required.
  3. Commit the updated .terraform.lock.hcl and re-run terraform plan.

Exam tip: Re-run terraform init any time you add a provider, add or change a module, or change the backend.

Terraform init, validate, and plan: the core workflow explained — the lesson that teaches this.

What Terraform 004 domain 3 tests, topic by topic

The official exam guide breaks Core Terraform workflow into 2 topics. The question bank follows the same split, so a weak topic shows up as a cluster of misses you can go back and read.

Published Terraform 004 practice questions per topic in Core Terraform workflow
TopicWhat it coversQuestions
The core workflow: init, validate, and planOfficial Terraform Associate 004 objective 3 (part 1). Describing the Terraform workflow; initializing a working directory; validating a configuration; generating and reviewing an execution plan.20
Applying, destroying, and formatting configurationOfficial Terraform Associate 004 objective 3 (part 2). Applying changes to infrastructure; destroying Terraform-managed infrastructure; applying formatting and style adjustments to a configuration.20
Total40

Revise Core Terraform workflow before you drill it

Other Terraform 004 domains

Core Terraform workflow: your questions

Core Terraform workflow is domain 3 of the Terraform 004 exam guide and carries 19% of the scored content — the 2nd-heaviest of the 8 domains. On a 57-question paper that works out to roughly 11 questions, though HashiCorp does not publish an exact per-domain count and individual exam forms vary.

Source

The domain weight and topic list on this page come from the official Terraform 004 exam guide.