TF-004 Terraform Cloud Backend Practice Question
You are managing a Terraform configuration that deploys resources across multiple AWS accounts using provider aliases. The configuration uses a single backend (S3) to store the state file. Recently, you discovered that the state file has become very large (over 100 MB) and is causing slow operations and timeouts. The team wants to improve performance without losing the ability to manage all resources with a single `terraform apply`. You need to propose a solution. Which approach should you take?
⚠ Common exam trap
A common misconception is that Terraform workspaces allow a single `terraform apply` to manage all resources. In reality, each workspace requires its own apply, so workspaces do not satisfy the requirement of a single apply command.
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
✓
Switch the backend from S3 to Terraform Cloud to improve performance
Switching to Terraform Cloud can improve performance with large state files due to its optimized backend, remote state management, and built-in caching. It allows you to continue managing all resources with a single `terraform apply` command, as Terraform Cloud handles state operations efficiently. This approach does not require splitting the state file or using multiple workspaces, thus preserving the ability to apply all changes in one operation.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use state encryption to compress the state file
Why it's wrong here
State encryption is a critical security measure designed to protect sensitive data stored within the Terraform state file at rest, preventing unauthorized access to infrastructure details. However, encryption does not compress the state file; in fact, it can sometimes slightly increase file size due to cryptographic overhead and padding. Therefore, encrypting the state file offers no benefit in terms of reducing file size or improving the performance of Terraform operations on a large state.
- ✓
Switch the backend from S3 to Terraform Cloud to improve performance
Why this is correct
Switching to Terraform Cloud provides a managed backend that can handle large state files efficiently with built-in state locking, remote execution, and caching. This allows you to continue using a single `terraform apply` to manage all resources.
- ✗
Use Terraform workspaces to separate environments into different state files
Why it's wrong here
Using Terraform workspaces separates state files for different instances of the *same* configuration, allowing distinct environments (e.g., dev, staging, prod) to be managed. However, each workspace still requires an individual `terraform apply` command to provision its resources. This approach does not consolidate management into a single `terraform apply` operation across all environments, nor does it inherently improve the performance of a single, large configuration's plan or apply phase. It is a method for environment isolation, not performance optimization for a monolithic state.
- ✗
Split the configuration into separate directories for each environment
Why it's wrong here
Splitting a Terraform configuration into separate directories for each environment creates distinct, independent configurations, each with its own state file. While this promotes modularity and can be beneficial for team organization, it necessitates running `terraform apply` separately for each directory and environment. This approach fundamentally breaks the ability to manage all resources with a single `terraform apply` command, as each directory represents a standalone deployment unit, rather than a unified, performance-optimized configuration.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
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 →
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.