Courseiva
Understand IaC conceptsmediumMultiple ChoiceObjective-mapped

TF-004 Understand IaC concepts Practice Question

Exhibit

resource "aws_iam_user" "example" {
  path = "/system/"
}

Refer to the exhibit. What will happen when you run terraform plan?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The plan will fail with an error about missing required argument.

The configuration is missing the required 'name' argument for an IAM user resource. Terraform will fail during the planning phase with an error indicating that the required argument is missing. Option C correctly identifies this error. Option A is incorrect because Terraform does not prompt for missing required arguments interactively; it fails with an error. Option B is incorrect because the plan cannot succeed without the required 'name' argument. Option D is incorrect because the resource cannot be created without the name; the path alone is insufficient.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The plan will prompt for the name interactively.

    Why it's wrong here

    Terraform's `plan` command is designed for non-interactive execution, meaning it does not prompt users for missing input during its operation. When a required argument like `name` is omitted, Terraform will not pause to ask for it. Instead, it will immediately identify the configuration as invalid and terminate with an error, adhering to its principle of explicit configuration.

  • The plan will succeed and create the IAM user with a generated name.

    Why it's wrong here

    The `aws_iam_user` resource explicitly defines `name` as a mandatory attribute within the AWS provider schema. Terraform providers are not designed to automatically generate values for required arguments if they are missing from the configuration. Consequently, omitting the `name` attribute will prevent the plan from succeeding, as the provider cannot proceed without this essential identifier.

  • The plan will fail with an error about missing required argument.

    Why this is correct

    Terraform performs rigorous configuration validation during the `plan` phase, checking the provided arguments against the resource's schema defined by its respective provider. For the `aws_iam_user` resource, the `name` attribute is unequivocally marked as required. Therefore, omitting this critical argument will trigger a validation error, causing the `terraform plan` command to fail before any changes can be proposed or applied.

  • The plan will create the user with the path only.

    Why it's wrong here

    While `path` is an optional attribute for an `aws_iam_user`, it serves a different purpose than the mandatory `name` attribute, which uniquely identifies the user. Terraform's validation process will detect the absence of the required `name` before considering any optional attributes like `path`. Without the fundamental `name` argument, the resource definition is incomplete and cannot be used to create an IAM user, regardless of other provided attributes.

About these practice questions

This TF-004 question is part of Courseiva's 428-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This TF-004 practice question is part of Courseiva's free HashiCorp certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the TF-004 exam.