TF-004 Understand Terraform's purpose Practice Question
Exhibit
{
"version": 4,
"terraform_version": "1.5.0",
"resources": [
{
"mode": "managed",
"type": "aws_instance",
"name": "web",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"attributes": {
"id": "i-0a1b2c3d4e5f67890",
"instance_type": "t2.micro"
},
"dependencies": [
"aws_security_group.web_sg"
]
}
]
}
]
}Refer to the exhibit. A team is troubleshooting a Terraform deployment. What information can be inferred from this state file?
⚠ Common exam trap
A common trick in Terraform exams is to assume that a `depends_on` entry in the state file means the dependency was 'not applied' or that the state file is invalid without a `terraform_version`, but in reality the presence of the dependency list confirms it was recorded and enforced.
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
✓
There is one EC2 instance of type t2.micro with a dependency on a security group.
The state file explicitly shows a resource of type `aws_instance` with `instance_type = "t2.micro"` and a `depends_on` meta-argument referencing `aws_security_group.example`. This indicates that Terraform recorded the EC2 instance as created with a t2.micro type and that it has a formal dependency on a security group resource, ensuring the security group is created before the instance during apply.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The Terraform version is outdated and must be upgraded.
Why it's wrong here
Terraform version 1.5.0, as indicated in the exhibit, is a relatively recent release within the 1.x series. HashiCorp maintains a stable 1.x branch, with new minor versions frequently introducing enhancements and bug fixes rather than deprecating previous minor versions within the same major release. Therefore, there is no inherent indication that this specific version is outdated or requires an immediate upgrade for basic functionality, especially without encountering specific version-related errors.
- ✓
There is one EC2 instance of type t2.micro with a dependency on a security group.
Why this is correct
The Terraform state file, as presented in the exhibit, explicitly shows a single `aws_instance` resource. Within its attributes, `instance_type` is clearly set to `t2.micro`. Furthermore, the `vpc_security_group_ids` attribute contains an array with one entry, indicating an explicit dependency on a security group resource. This direct evidence from the state confirms the presence and configuration of the EC2 instance and its security group association.
- ✗
The instance ID is invalid and needs to be recreated.
Why it's wrong here
The instance ID `i-0a1b2c3d4e5f6a7b8` follows the standard AWS EC2 instance ID format, which typically starts with `i-` followed by 17 alphanumeric characters. There is no information in the exhibit to suggest this ID is invalid, corrupted, or causing any operational issues. Terraform manages resource IDs internally, and an invalid ID would likely manifest as an API error during apply or refresh operations, which is not indicated here.
- ✗
The security group dependency was not applied.
Why it's wrong here
The Terraform state explicitly records the `vpc_security_group_ids` attribute for the `aws_instance` resource, indicating that the dependency on a security group *was* successfully applied and associated with the instance during its creation or last update. The presence of this attribute in the state confirms Terraform's successful application of the configuration. If the security group itself were missing or misconfigured, it would be a separate issue, but the dependency itself was indeed applied.
Go deeper
Related to this question
About these practice questions
One of 428 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 →
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.