Courseiva
Deployment →mediumMultiple Choice

CV0-004 Deployment Practice Question

A cloud engineer is writing a Terraform configuration to deploy an AWS EC2 instance. The engineer wants to pass the AMI ID and instance type into the configuration at runtime without hardcoding them. Which Terraform feature should be used?

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

✓

Variables

Variables in Terraform allow you to define parameters that can be supplied at runtime, making configurations reusable and flexible.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Locals

    Why it's wrong here

    Locals only assign names to expressions evaluated within the module, so runtime values supplied by the operator cannot flow in without editing the code. They suit computed intermediate values, such as a derived naming prefix, not externally supplied AMI IDs or instance types.

  • ✗

    Outputs

    Why it's wrong here

    Outputs expose values after apply, such as the instance ID, and cannot supply inputs to resources. They tempt for sharing results between configurations, but runtime parameterisation of the AMI ID and instance type requires input variables declared with variable blocks.

  • ✓

    Variables

    Why this is correct

    Input variables let the configuration accept the AMI ID and instance type at runtime via CLI flags, variable files, or environment variables, rather than hardcoding values. This satisfies the requirement to pass values in without editing the configuration.

  • ✗

    Data sources

    Why it's wrong here

    Data sources query existing provider resources, such as the latest Amazon Linux AMI, rather than accepting operator-supplied values at runtime. They fit dynamic lookups of infrastructure state, not passing arbitrary AMI IDs and instance types chosen per deployment.

About these practice questions

This CV0-004 question is part of Courseiva's 834-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.