- A
Use Terraform workspaces with a single state file
Why wrong: Workspaces still store state in the same backend, but separate state files; however, they can be used with different keys.
- B
Use separate state files with unique S3 key prefixes per account
Unique key prefixes ensure each account has its own state file.
- C
Store all state in the same S3 key
Why wrong: Using the same key would overwrite state, causing data loss.
- D
Use a DynamoDB table with different lock IDs per account
Why wrong: Locking doesn't isolate state; it only prevents concurrent access.
Quick Answer
The correct approach is to use separate state files with unique S3 key prefixes per account. This works because S3’s hierarchical key structure allows you to logically isolate state files within a single bucket by assigning each AWS account its own distinct prefix, such as `account-123456789012/terraform.tfstate`, preventing cross-account state contamination while centralizing storage. On the HashiCorp Terraform Associate TF-003 exam, this scenario tests your understanding of backend configuration flexibility and the difference between workspace-based isolation and key-based isolation—a common trap is assuming workspaces or separate buckets are required, but the question explicitly asks for a single bucket solution. The key insight is that Terraform’s backend `key` parameter supports dynamic interpolation, enabling per-account prefixes without extra infrastructure. Memory tip: think of S3 key prefixes like folders in a filing cabinet—each account gets its own labeled folder, but everything stays in one drawer.
TF-003 Implement and maintain state Practice Question
This TF-003 practice question tests your understanding of implement and maintain state. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
A company uses Terraform to manage infrastructure across multiple AWS accounts. They want to use a single S3 bucket to store state files for all accounts, but ensure that state files are isolated per account. What is the best approach?
Clue words in this question
Noticing these words before you look at the options changes how you read each choice.
Clue:
"best"Why it matters: Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.
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
Use separate state files with unique S3 key prefixes per account
Option B is correct because using separate state files with unique S3 key prefixes per account ensures that each AWS account's Terraform state is stored in the same S3 bucket but logically isolated. This approach leverages S3's hierarchical key structure to prevent cross-account state contamination, while still allowing centralized management. Terraform's backend configuration supports dynamic key prefixes (e.g., `key = "account-${var.account_id}/terraform.tfstate"`), enabling per-account isolation without requiring separate buckets or workspaces.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
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 Terraform workspaces with a single state file
Why it's wrong here
Workspaces still store state in the same backend, but separate state files; however, they can be used with different keys.
- ✓
Use separate state files with unique S3 key prefixes per account
Why this is correct
Unique key prefixes ensure each account has its own state file.
Clue confirmation
The clue word "best" in the question point toward this answer.
Related concept
Read the scenario before looking for a memorised answer.
- ✗
Store all state in the same S3 key
Why it's wrong here
Using the same key would overwrite state, causing data loss.
- ✗
Use a DynamoDB table with different lock IDs per account
Why it's wrong here
Locking doesn't isolate state; it only prevents concurrent access.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates confuse Terraform workspaces with true state isolation across accounts, not realizing that workspaces only provide logical separation within a single backend path and do not prevent cross-account state conflicts when using a shared S3 bucket.
Detailed technical explanation
How to think about this question
Under the hood, Terraform's S3 backend uses the `key` parameter to construct the full object path in the bucket. By parameterizing the key with a unique identifier per account (e.g., account ID or alias), each account's state is stored as a separate object, enabling independent `terraform plan` and `apply` operations. This pattern also integrates with DynamoDB for state locking—each account can use the same DynamoDB table but with different lock IDs (or the same table with a composite key) to prevent concurrent modifications to the same state file. In real-world multi-account setups, this approach is combined with IAM policies that restrict each account's access to only its own key prefix, enhancing security.
KKey Concepts to Remember
- Read the scenario before looking for a memorised answer.
- Find the constraint that changes the correct option.
- Eliminate answers that are true in general but not in this case.
TExam Day Tips
- Watch for words such as best, first, most likely and least administrative effort.
- Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
- →
Implement and maintain state — study guide chapter
Learn the concepts, then practise the questions
- →
Implement and maintain state practice questions
Targeted practice on this topic area only
- →
All TF-003 questions
519 questions across all exam domains
- →
HashiCorp Terraform Associate TF-003 study guide
Full concept coverage aligned to exam objectives
- →
TF-003 practice test guide
How to use practice tests most effectively before exam day
Related practice questions
Related TF-003 practice-question pages
Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.
Understand IaC concepts practice questions
Practise TF-003 questions linked to Understand IaC concepts.
Understand Terraform basics practice questions
Practise TF-003 questions linked to Understand Terraform basics.
Understand Terraform's purpose practice questions
Practise TF-003 questions linked to Understand Terraform's purpose.
Use Terraform outside the core workflow practice questions
Practise TF-003 questions linked to Use Terraform outside the core workflow.
Interact with Terraform modules practice questions
Practise TF-003 questions linked to Interact with Terraform modules.
Use the core Terraform workflow practice questions
Practise TF-003 questions linked to Use the core Terraform workflow.
Implement and maintain state practice questions
Practise TF-003 questions linked to Implement and maintain state.
Read, generate and modify configuration practice questions
Practise TF-003 questions linked to Read, generate and modify configuration.
TF-003 fundamentals practice questions
Practise TF-003 questions linked to TF-003 fundamentals.
TF-003 scenario practice questions
Practise TF-003 questions linked to TF-003 scenario.
TF-003 troubleshooting practice questions
Practise TF-003 questions linked to TF-003 troubleshooting.
Practice this exam
Start a free TF-003 practice session
Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.
FAQ
Questions learners often ask
What does this TF-003 question test?
Implement and maintain state — This question tests Implement and maintain state — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Use separate state files with unique S3 key prefixes per account — Option B is correct because using separate state files with unique S3 key prefixes per account ensures that each AWS account's Terraform state is stored in the same S3 bucket but logically isolated. This approach leverages S3's hierarchical key structure to prevent cross-account state contamination, while still allowing centralized management. Terraform's backend configuration supports dynamic key prefixes (e.g., `key = "account-${var.account_id}/terraform.tfstate"`), enabling per-account isolation without requiring separate buckets or workspaces.
What should I do if I get this TF-003 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Are there clue words in this question I should notice?
Yes — watch for: "best". Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 11, 2026
This TF-003 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-003 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.