Courseiva

TF-004 Understand Terraform basics Practice Question

Exhibit

resource "aws_s3_bucket" "example" {}

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

⚠ Common exam trap

HashiCorp Terraform exams often test the misconception that Terraform can auto-generate resource names or prompt for missing required arguments, when in fact it strictly validates configuration against the provider's schema and fails on missing required fields.

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

✓

It will fail with an error about missing required argument.

The Terraform configuration for an AWS S3 bucket requires the `bucket` argument to be explicitly set. If the `bucket` argument is omitted, Terraform will fail during `terraform plan` with an error indicating a missing required argument, as the provider cannot infer or generate a bucket name automatically without explicit configuration.

Answer analysis

Option-by-option breakdown

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

  • ✓

    It will fail with an error about missing required argument.

    Why this is correct

    The configuration omits a value for a required argument in a resource block, so Terraform's validation during plan fails before generating any execution plan. The provider schema marks that argument mandatory, producing a missing required argument error.

  • ✗

    It will prompt for the bucket name.

    Why it's wrong here

    Terraform never interactively prompts for missing required arguments during plan; it reports an error and exits. Prompting for variable values occurs only with undefined input variables, which would be the correct mechanism when the stem used a variable rather than a literal bucket argument.

  • ✗

    It will create a bucket with a random name.

    Why it's wrong here

    Terraform does not invent random names for a bucket argument; an omitted or invalid name yields a validation error rather than a generated identifier. Random naming is provided by the random provider's random_id resource, which would be the correct choice when uniqueness must be guaranteed.

  • ✗

    It will succeed because bucket name can be generated automatically.

    Why it's wrong here

    Terraform cannot generate a bucket name automatically for the aws_s3_bucket bucket argument; the plan fails validation before any apply. Automatic generation applies to resources such as random_pet or random_id, which would be correct when a unique name must be produced.

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

One of 434 original TF-004 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.