SaveMyCert
Log in
5 of 5 free questions left today·for 10 a day
Terraform Pro 002 · Domain 1

Scalable Terraform configuration design practice questions

Scalable Terraform configuration design is worth 20% of the Terraform Pro 002 exam — the 2nd-heaviest of the 7 domains. Turning requirements into predictable, secure configuration: tracing variables, locals, outputs and for_each, predicting function results, advanced configuration, providers and the Terraform MCP server. HashiCorp publishes no weights; weight approximates the sub-objective share. 6 fully worked examples are further down this page, answers included.

Exam weight
20%
the 2nd-heaviest of the 7 domains
Questions
160
across 4 topics
Free, no account
5/day
a free account allows 10 a day
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 7 domains, in Learn mode.

Review what you missed

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 Scalable Terraform configuration design questions, fully explained

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

Question 1Scalable Terraform configuration design

A module that targets Terraform 1.15 declares these inputs:variable "min_size" { type = number } variable "max_size" { type = number validation { condition = var.max_size >= var.min_size error_message = "max_size must be at least min_size." } }A caller sets min_size = 4 and max_size = 2. What happens when the caller runs terraform plan?

Choose one.

  • a
    Terraform reports the validation error message and produces no plan Correct

    Since Terraform 1.9, validation conditions can refer to other variables in the same module, so the rule is evaluated and fails before a plan is produced.

  • b
    Terraform rejects the module because validation may reference var.max_size alone

    That restriction applied before Terraform 1.9. Current versions allow validation rules to refer to other input variables and objects in the module.

  • c
    Terraform produces the plan and prints the error message as a warning

    A failed validation is an error, not a warning; only check blocks downgrade failures to warnings.

  • d
    Terraform produces the plan and reports the error message later, during apply

    Validation runs before planning when the values are known, as both literals are here; it does not wait until apply.

The concept

Input variable validation rules can reference other variables and objects in the same module (Terraform 1.9 and later).

Why that’s the answer

The values are literals, so they are known before planning. Terraform 1.9 made validation conditions general expressions that may reference other input variables, so var.min_size is allowed and the comparison 2 >= 4 is false. Validation failure is an error that stops the run before a plan. The tempting distractor describes the pre-1.9 rule that a condition could reference only its own variable.

How to reason it out
  1. Check the Terraform version: 1.15 is well past 1.9.
  2. Recall that validation may reference other variables since 1.9.
  3. Evaluate the condition with the caller's values: 2 >= 4 is false.
  4. Recall that a failed validation is an error raised before planning.

Exam tip: Since Terraform 1.9, a validation block can compare one input with another.

Terraform Professional (002): Turning Requirements into Predictable, Secure Configuration — the lesson that teaches this.

Question 2Scalable Terraform configuration design

A root module reads a shared VPC with a data source. A private DNS zone in the module needs DNS hostnames enabled on that VPC; the subnets and route tables in the module do not. Other configurations reuse the same data source pattern for VPCs that legitimately have DNS hostnames disabled. The plan-time error must be declared on, and name, the resource that relies on the setting. Where should the condition go?

Choose one.

  • a
    A precondition in the DNS zone's lifecycle block that tests the VPC's enable_dns_hostnames Correct

    A precondition belongs to the consumer that relies on the assumption; it errors when the DNS zone is planned and records why that resource needs the setting.

  • b
    A postcondition on the VPC data source that tests self.enable_dns_hostnames

    A postcondition on the data source states a guarantee for every consumer, so it would also fail runs that only create subnets or route tables against VPCs that legitimately lack the setting.

  • c
    A check block that asserts the VPC data source's enable_dns_hostnames

    A check block reports only a warning, so the DNS zone would still be planned against a VPC that cannot serve it.

  • d
    A validation block on the VPC name variable that tests the data source's enable_dns_hostnames

    A validation block belongs to the input, not to the DNS zone, so the error is not declared on the resource that relies on the setting.

The concept

Preconditions express assumptions a specific resource makes; postconditions express guarantees an object provides to every consumer.

Why that’s the answer

Only the DNS zone depends on DNS hostnames. A precondition in that resource's lifecycle block is checked while Terraform plans the zone, errors with a message about the zone, and documents the assumption next to the code that relies on it. A postcondition on the data source would claim the setting is guaranteed for every consumer, so configurations that only build subnets or route tables against VPCs without it would fail too. A check block never errors, and a variable validation describes the input rather than the resource that needs the setting.

How to reason it out
  1. Decide whether the rule is a guarantee for all consumers or an assumption of one consumer.
  2. Here only the DNS zone relies on it, so it is an assumption.
  3. Assumptions go in a precondition on the consuming resource.
  4. Reject options that attach the rule to every consumer, to the input, or that only warn.

Exam tip: Put an assumption in a precondition on the resource that relies on it, not on the shared source.

Terraform Professional (002): Turning Requirements into Predictable, Secure Configuration — the lesson that teaches this.

Question 3Scalable Terraform configuration design

After each apply, an operations team wants Terraform to confirm that the public endpoint of a new load balancer returns HTTP 200. A failing endpoint must never block an apply of unrelated changes, and the team also wants HCP Terraform to re-test the endpoint between runs and alert them. What should they configure?

Choose one.

  • a
    A postcondition on the load balancer that asserts an http data source's status, plus terraform validate in CI

    A failing postcondition is an error that halts dependent actions, so a slow endpoint would block other changes, and terraform validate never contacts the endpoint.

  • b
    A precondition on a top-level http data source, plus health assessments on the workspace

    Health assessments would re-test it, but a failing precondition is an error that stops the run, breaking the no-blocking requirement.

  • c
    A check block with a scoped http data source and an assert, run by terraform validate in CI

    The check block is right, but terraform validate does not read data sources or contact infrastructure, and it does not re-test between runs.

  • d
    A check block with a scoped http data source and an assert, plus health assessments on the workspace Correct

    Check blocks report failures as warnings without blocking, and HCP Terraform health assessments re-evaluate them between runs and notify on failure.

The concept

Check blocks validate infrastructure behaviour without blocking operations, and HCP Terraform health assessments re-evaluate them continuously.

Why that’s the answer

Two requirements decide: failures must not block, and the test must repeat between runs. Check blocks are the only custom condition whose failure is a warning, and a scoped data source inside the check keeps a failed HTTP read from erroring the run. Enabling health assessments on the workspace makes HCP Terraform re-run checks (with preconditions and postconditions) and alert. Postconditions and preconditions error; terraform validate never reaches the endpoint.

How to reason it out
  1. Pick the condition type whose failure is a warning: a check block.
  2. Use a scoped data source inside the check so a failed read also stays a warning.
  3. Add continuous re-evaluation: health assessments in HCP Terraform.
  4. Reject options that error or that never contact the endpoint.

Exam tip: Check blocks warn instead of blocking, and health assessments re-run them between applies.

Terraform Professional (002): Turning Requirements into Predictable, Secure Configuration — the lesson that teaches this.

Question 4Scalable Terraform configuration design

A root module contains this configuration:variable "db_password" { type = string sensitive = true } output "connection_string" { value = "postgres://app:${var.db_password}@${aws_db_instance.main.address}/app" }What happens when an engineer runs terraform plan?

Choose one.

  • a
    Terraform plans the change and prints the whole string in clear text

    Sensitivity propagates through string templates, and Terraform refuses to expose it through an unmarked output rather than printing it.

  • b
    Terraform plans the change and shows the output as a sensitive value

    Terraform does not silently mark the output sensitive; it requires the author to declare sensitive = true on the output.

  • c
    Terraform returns an error saying the output refers to sensitive values Correct

    A root module output whose value derives from a sensitive value must itself set sensitive = true; otherwise Terraform errors.

  • d
    Terraform plans the change and redacts just the password part of the string

    Terraform does not partially redact strings; the derived value is sensitive as a whole, and the unmarked output is an error.

The concept

Sensitivity propagates to every value derived from a sensitive value, and an output exposing such a value must be declared sensitive.

Why that’s the answer

The template includes var.db_password, so the whole string is sensitive. Terraform will not let an output expose a sensitive value unless the output is explicitly marked sensitive = true, so it raises an error during planning. It does not quietly redact the output or part of the string, and it never prints it in clear text.

How to reason it out
  1. Trace the output's value back to a sensitive input.
  2. Recall that derived values inherit sensitivity.
  3. Recall that an unmarked output exposing a sensitive value is an error.
  4. Fix by adding sensitive = true to the output.

Exam tip: An output built from a sensitive value must be marked sensitive, or the plan fails.

Terraform Professional (002): Turning Requirements into Predictable, Secure Configuration — the lesson that teaches this.

Question 5Scalable Terraform configuration design

A team marks the database password variable in its root module with sensitive = true and tells auditors the secret is now protected everywhere Terraform handles it. The password is passed to the password argument of a database resource. Which TWO statements about this setup are correct? (Select TWO.)

Choose TWO.

  • a
    The value is encrypted inside the state file with a key Terraform manages

    Terraform does not encrypt individual values in state; protection of state at rest depends on the backend.

  • b
    The value is left out of the saved plan file the pipeline uploads

    Saved plan files contain sensitive values; only ephemeral values are omitted from plan and state files.

  • c
    The value is redacted in the plan and apply output shown to the team Correct

    Marking a variable sensitive hides its value, and values derived from it, in plan and apply output.

  • d
    The value is recorded in plain text in the state file Correct

    Terraform still records sensitive values in state; sensitive affects display, not storage.

  • e
    The value is shown in clear text when a local value derives a string from it

    Sensitivity propagates to derived values, so a local built from it is also redacted.

The concept

sensitive = true controls display only; the value is still persisted in state and saved plans.

Why that’s the answer

The sensitive argument redacts values in CLI output and carries the mark through every expression derived from them. It does not change what Terraform stores: a value used by a resource argument is written to state, and saved plan files also contain it. That is why state and plan artefacts must be protected by the backend and pipeline, and why ephemeral values and write-only arguments exist for secrets that must never be persisted.

How to reason it out
  1. Separate display from storage.
  2. Sensitive changes display: redacted output, propagated marks.
  3. Sensitive does not change storage: state and plan files keep the value.
  4. Use ephemeral values or write-only arguments when storage itself is the risk.

Exam tip: Sensitive hides a value on screen; it does not keep it out of state or plan files.

Terraform Professional (002): Turning Requirements into Predictable, Secure Configuration — the lesson that teaches this.

Question 6Scalable Terraform configuration design

A security requirement says the administrator password of a new PostgreSQL database must be generated by Terraform and must never appear in the state file or a saved plan. The team runs Terraform 1.15 with an AWS provider version whose aws_db_instance supports write-only arguments. Which configuration meets the requirement?

Choose one.

  • a
    An ephemeral random_password whose result is passed to password_wo with a password_wo_version Correct

    The ephemeral resource is never persisted, and a write-only argument is never stored in state or plan; bumping the version argument rotates it.

  • b
    A random_password resource marked sensitive whose result is passed to the password argument

    A managed random_password stores its result in state, and the password argument is also stored; sensitive only redacts output.

  • c
    An ephemeral random_password whose result is passed to the regular password argument

    Ephemeral values cannot be assigned to ordinary arguments that are persisted; Terraform rejects the reference.

  • d
    A random_password resource whose result is passed to password_wo with a password_wo_version

    The write-only argument is not stored, but the managed random_password resource still writes the generated value to state.

The concept

Ephemeral resources produce values that are never persisted, and write-only arguments accept values without storing them in state or plan.

Why that’s the answer

Both the generator and the consumer must avoid persistence. An ephemeral random_password exists only during the run, and password_wo is a write-only argument that Terraform never stores; because Terraform cannot detect changes to it, the provider pairs it with password_wo_version, which is stored and incremented to push a new value. A managed random_password leaks the secret into state on its own, and ordinary arguments cannot take ephemeral values.

How to reason it out
  1. List every place the secret could be persisted: the generator and the consumer.
  2. Make the generator ephemeral so its result is never stored.
  3. Make the consumer a write-only argument so the database resource does not store it.
  4. Use the paired version argument to trigger rotation later.

Exam tip: To keep a secret out of state: ephemeral source plus write-only argument, rotated by its version argument.

Terraform Professional (002): Turning Requirements into Predictable, Secure Configuration — the lesson that teaches this.

What Terraform Pro 002 domain 1 tests, topic by topic

The official exam guide breaks Scalable Terraform configuration design into 4 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 Pro 002 practice questions per topic in Scalable Terraform configuration design
TopicWhat it coversQuestions
Requirements to predictable, secure configurationOfficial Terraform Infrastructure Engineer Professional (002) objectives, 1a Translate business requirements into infrastructure code; 1b Predictable and secure Terraform configuration.40
Tracing variables, locals, outputs and for_eachOfficial Terraform Infrastructure Engineer Professional (002) objectives, 1c Trace input variables, local values, and outputs to identify the source of a configuration issue; 1d Trace dynamic resources created with for_each.40
Functions, expressions and advanced configurationOfficial Terraform Infrastructure Engineer Professional (002) objectives, 1e Predict the value of an expression that uses a Terraform function; 1f Implement advanced configurations.40
Providers and the Terraform MCP serverOfficial Terraform Infrastructure Engineer Professional (002) objectives, 1g Configure Terraform providers; 1h Use the Terraform MCP server to enhance development with AI coding agents.40
Total160

Revise Scalable Terraform configuration design before you drill it

Other Terraform Pro 002 domains

Scalable Terraform configuration design: your questions

Scalable Terraform configuration design is domain 1 of the Terraform Pro 002 exam guide and carries 20% of the scored content — the 2nd-heaviest of the 7 domains. HashiCorp has not yet published the exam's question count, so there is no per-domain number of questions to give.

Source

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