Courseiva

TF-004 Use Terraform outside the core workflow Practice Question

A company uses Terraform with a remote backend (AWS S3). They want to ensure that the state file is encrypted at rest. Which configuration approach guarantees this?

⚠ Common exam trap

Candidates often confuse provider-level encryption settings (which don't exist) with backend-level encryption, or assume a CLI flag like `-encrypt-state` exists, when in fact encryption must be explicitly declared in the backend configuration block.

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

✓

Configure the S3 backend with server-side encryption enabled (e.g., 'encrypt = true' and 'kms_key_id').

The S3 backend configuration block supports the `encrypt` and `kms_key_id` arguments, which enable server-side encryption (SSE-S3 or SSE-KMS) for the state file stored in the S3 bucket. This ensures that the state file is encrypted at rest, meeting the requirement without any additional steps or external commands.

Answer analysis

Option-by-option breakdown

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

  • ✓

    Configure the S3 backend with server-side encryption enabled (e.g., 'encrypt = true' and 'kms_key_id').

    Why this is correct

    Enabling server-side encryption on the S3 backend satisfies the encryption-at-rest constraint, since Terraform delegates state storage to S3 and AWS encrypts objects before writing them to disk. Specifying `kms_key_id` uses SSE-KMS for customer-managed key control, while `encrypt = true` alone applies SSE-S3. Encryption therefore occurs at the storage layer, independent of Terraform itself.

  • ✗

    Enable encryption in the AWS provider block.

    Why it's wrong here

    Provider-block encryption settings apply to resources Terraform creates, not to the S3 backend storing state; the backend's own encrypt attribute controls state encryption. It is tempting because provider configuration is where AWS resource encryption is normally declared, which would be correct for encrypting an S3 bucket created as a resource.

  • ✗

    Use 'terraform state encrypt' command.

    Why it's wrong here

    No such command exists in Terraform's CLI, so it cannot encrypt anything. It is tempting because a dedicated encryption subcommand sounds like the obvious tool, and would be the right approach only if Terraform actually shipped such a command for backend state.

  • ✗

    Use 'terraform init -encrypt-state' flag.

    Why it's wrong here

    Terraform init accepts no -encrypt-state flag; encryption is configured in the backend block, not via CLI. It is tempting because init already configures the backend, so a flag there appears plausible, and would be correct if such a flag existed.

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

This TF-004 question is part of Courseiva's 434-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.