Courseiva
easyMultiple ChoiceObjective-mapped

CV0-004 Practice Question: Is reviewing a Terraform configuration for…

Exhibit

Refer to the exhibit.

```
resource "aws_instance" "web" {
  ami           = "ami-0abcdef1234567890"
  instance_type = "t2.micro"
  subnet_id     = "subnet-abc123"
  vpc_security_group_ids = ["sg-12345678"]
  user_data     = <<-EOF
                  #!/bin/bash
                  yum install -y httpd
                  systemctl start httpd
                  EOF
}
```

A cloud engineer is reviewing a Terraform configuration for deploying a web server. The instance is created successfully, but the web server does not start. What is the most likely cause?

⚠ Common exam trap

Test-takers frequently confuse the web server not starting with it being unreachable, and may incorrectly choose the security group option. The actual cause is an AMI mismatch, which is a common oversight when using Terraform with a user_data script designed for a different OS.

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

The AMI ID is for a Windows instance, but the script uses yum.

If the AMI ID is for a Windows instance but the user_data script uses yum (a Linux package manager), the script will fail to execute, causing the web server not to start. This is a common mismatch when using Terraform with incorrect AMI types. Option B (security group) would not prevent the web server process from starting; it would only block inbound access, which does not match the symptom 'web server does not start.' Options A and D are less likely causes for the server not starting.

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 subnet is in a private zone without internet access.

    Why it's wrong here

    The subnet being in a private zone without internet access would not prevent the web server from starting; it would only affect outbound connectivity or external access. This is not the most likely cause.

  • The security group does not allow inbound HTTP traffic.

    Why it's wrong here

    The security group not allowing inbound HTTP traffic would block client requests but would not prevent the web server process from starting. The server would still be running locally, contradicting the symptom.

  • The AMI ID is for a Windows instance, but the script uses yum.

    Why this is correct

    Correct. Using a Windows AMI but executing Linux-specific commands (yum) causes the user_data script to fail, preventing the web server from starting. This is a common configuration error.

  • The user_data script lacks execute permissions.

    Why it's wrong here

    Lack of execute permissions on user_data script is possible but less likely than a fundamental OS mismatch. Most cloud platforms do not require explicit execute permissions for user_data scripts.

About these practice questions

This CV0-004 question is part of Courseiva's 977-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 CV0-004 practice question is part of Courseiva's free CompTIA 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 CV0-004 exam.