TF-004 Understand Terraform's purpose Practice Question
Exhibit
provider "aws" {
region = "us-east-1"
}
resource "aws_s3_bucket" "mybucket" {
bucket = "my-unique-bucket-12345"
acl = "private"
}
resource "aws_s3_bucket" "mybucket" {
bucket = "my-unique-bucket-67890"
acl = "public-read"
}Refer to the exhibit. A user attempts to run terraform apply with this configuration. What error will occur?
⚠ Common exam trap
A common pitfall is confusing Terraform's core language validation (which catches duplicate resource names) with provider-level validation (which catches invalid bucket names or missing configurations). This question tests the distinction between a local naming error and a provider or API error.
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
✓
Duplicate resource name "mybucket"
Terraform requires every resource block to have a unique address within the same module. If two `aws_s3_bucket` resources both use the same logical name `mybucket`, Terraform will reject the configuration with a `Duplicate resource name` error during the `plan` or `apply` phase. This is a fundamental rule of Terraform's configuration language, enforced at parse time before any provider interaction occurs.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Conflicting access control settings
Why it's wrong here
Conflicting access control settings, such as IAM policies or bucket ACLs, would typically result in a permissions error during the `terraform apply` execution phase when the AWS API rejects the resource creation or modification request. However, Terraform's validation process identifies structural and naming conflicts within the configuration *before* attempting API calls. Therefore, a configuration error like a duplicate resource definition would be flagged prior to any potential access control failures.
- ✗
Missing required provider configuration
Why it's wrong here
The exhibit clearly shows a `provider "aws" { ... }` block defined within the Terraform configuration, which satisfies the requirement for specifying the AWS provider. This block correctly declares the necessary provider and its configuration, such as the region. Therefore, the issue is not a missing or improperly defined provider configuration, as Terraform successfully identifies and loads the provider.
- ✓
Duplicate resource name "mybucket"
Why this is correct
Terraform requires that all resources within a given module have a unique combination of resource type and local name. In the provided configuration, there are two separate `aws_s3_bucket` resources both declared with the local name `mybucket`. This duplication creates an ambiguous reference and violates Terraform's naming conventions, leading to a validation error during the plan or apply phase because Terraform cannot uniquely identify or manage these distinct resources.
- ✗
Invalid bucket name pattern
Why it's wrong here
The bucket name `mybucket` consists of lowercase letters and is between 3 and 63 characters long, which fully complies with AWS S3 bucket naming conventions. AWS S3 bucket names can contain lowercase letters, numbers, and hyphens, and must start and end with a letter or number. Thus, the specified bucket name itself is syntactically valid according to AWS S3 rules, and this is not the source of the configuration error.
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.