The correct answer is to change the `associate_public_ip_address` argument to `false` in the Terraform resource block. This argument directly controls whether an Elastic IP or a public IPv4 address is assigned to the instance upon launch; setting it to false ensures the instance remains private, aligning with the subnet’s intended policy. On the CompTIA Cloud+ CV0-004 exam, this question tests your ability to interpret Terraform configuration and enforce network security controls, often appearing as a scenario where a cloud administrator must prevent public IP on Terraform instance without altering the subnet or VPC. A common trap is assuming that changing the subnet or VPC alone will fix the issue, but the `associate_public_ip_address` flag is the precise toggle. Memory tip: think of it as the “public IP kill switch” — set it false to keep the instance off the internet.
CV0-004 Deployment Practice Question
This CV0-004 practice question tests your understanding of deployment. 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.
Exhibit
Refer to the exhibit.
```
$ terraform plan
...
# aws_instance.web will be created
+ resource "aws_instance" "web" {
+ ami = "ami-0c55b159cbfafe1f0"
+ instance_type = "t2.micro"
+ subnet_id = "subnet-06e3d2f8a8b9c1234"
+ vpc_security_group_ids = [
+ "sg-0123456789abcdef0",
]
+ associate_public_ip_address = true
+ user_data = <<-EOT
#!/bin/bash
apt-get update
apt-get install -y nginx
systemctl enable nginx
EOT
+ tags = {
+ "Name" = "web-server"
}
}
Plan: 1 to add, 0 to change, 0 to destroy.
```
After reviewing the Terraform plan, a cloud administrator notices that the instance will be created with a public IP address. However, the company policy requires that all instances in this subnet remain private. What should the administrator do to meet the policy before applying the plan?
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Change the 'associate_public_ip_address' argument to 'false' in the resource block.
Option B is correct because setting 'associate_public_ip_address' to false will prevent the instance from receiving a public IP. Option A is wrong because changing subnet may not resolve the policy if the new subnet also allows public IP. Option C is wrong because using a non-default VPC does not automatically prevent public IPs. Option D is wrong because user_data does not affect network configuration.
Key principle: Count usable hosts — not total addresses — and remember that the network and broadcast addresses are not available to hosts in standard IPv4 subnets.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
✗
Add a shell command in user_data to remove the public IP after boot.
Why it's wrong here
Incorrect: Public IP is assigned at launch; removing it later is inefficient and not a Terraform approach.
✗
Use a different AMI that does not require public access.
Why it's wrong here
Incorrect: The AMI is not responsible for IP assignment.
✓
Change the 'associate_public_ip_address' argument to 'false' in the resource block.
Why this is correct
Correct: This explicitly disables public IP assignment.
Modify the subnet_id to point to a private subnet with no internet gateway.
Why it's wrong here
Incorrect: Even a private subnet might have auto-assign public IP enabled; the explicit attribute must be set.
Common exam traps
Common exam trap: usable hosts are not the same as total addresses
Subnetting questions often tempt you into counting all addresses. In normal IPv4 subnets, the network and broadcast addresses are not usable host addresses.
Detailed technical explanation
How to think about this question
Subnetting questions test whether you can identify the network, broadcast address, usable range, mask and correct subnet. Slow down enough to calculate the block size correctly.
KKey Concepts to Remember
CIDR notation defines the prefix length.
Block size helps identify subnet boundaries.
Network and broadcast addresses are not usable hosts in normal IPv4 subnets.
The required host count determines the smallest suitable subnet.
TExam Day Tips
→Write the block size before choosing the subnet.
→Check whether the question asks for hosts, subnets or a specific address range.
→Do not confuse /24, /25, /26 and /27 host counts.
Key takeaway
Count usable hosts — not total addresses — and remember that the network and broadcast addresses are not available to hosts in standard IPv4 subnets.
Real-world example
How this comes up in practice
A network engineer segments a warehouse floor into three subnets: 20 scanners, 5 printers, and 2 management hosts. Picking the wrong mask wastes addresses or leaves too few usable hosts. Exam questions test whether you can apply CIDR notation, calculate block size, and identify the correct usable-host range for a given prefix.
What to study next
Got this wrong? Here's your next step.
Review block sizes, usable host formulas (2^n − 2), and how to find network and broadcast addresses for /24 through /30. Then practise related CV0-004 subnetting questions on CIDR, address ranges, and subnet selection.
Deployment — This question tests Deployment — CIDR notation defines the prefix length..
What is the correct answer to this question?
The correct answer is: Change the 'associate_public_ip_address' argument to 'false' in the resource block. — Option B is correct because setting 'associate_public_ip_address' to false will prevent the instance from receiving a public IP. Option A is wrong because changing subnet may not resolve the policy if the new subnet also allows public IP. Option C is wrong because using a non-default VPC does not automatically prevent public IPs. Option D is wrong because user_data does not affect network configuration.
What should I do if I get this CV0-004 question wrong?
Review block sizes, usable host formulas (2^n − 2), and how to find network and broadcast addresses for /24 through /30. Then practise related CV0-004 subnetting questions on CIDR, address ranges, and subnet selection.
What is the key concept behind this question?
CIDR notation defines the prefix length.
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 →
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.
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.
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.