nerdexam
HashiCorpHashiCorp

TA-002-P · Question #253

TA-002-P Question #253: Real Exam Question with Answer & Explanation

The correct answer is B: module "consul" { source = "./consul"}. {"question_number": 3, "question": "Which one is the right way to import a local module named consul?", "correct_answer": "B. module \"consul\" { source = \"./consul\" } and C. module \"consul\" { source = \"../consul\" }", "explanation": "Local modules must be referenced using r

Interact with Terraform modules

Question

Which one is the right way to import a local module names consul?

Options

  • Amodule "consul" { source = "consul"}
  • Bmodule "consul" { source = "./consul"}
  • Cmodule "consul" { source = "../consul"}
  • Dmodule "consul" { source = "module/consul"}

Explanation

{"question_number": 3, "question": "Which one is the right way to import a local module named consul?", "correct_answer": "B. module "consul" { source = "./consul" } and C. module "consul" { source = "../consul" }", "explanation": "Local modules must be referenced using relative file paths that start with ./ (same directory) or ../ (parent directory). Option B (./consul) sources the module from a subdirectory called consul in the current directory. Option C (../consul) sources it from a sibling directory one level up. Option A (consul with no path prefix) would be interpreted as a Terraform Registry module, not a local path. Option D (module/consul) is also not a valid local path format - local paths must start with ./ or ../.", "generated_by": "claude-sonnet", "llm_judge_score": 4}

Topics

#Terraform Modules#Local Modules#Module Source#Relative Paths

Community Discussion

No community discussion yet for this question.

Full TA-002-P PracticeBrowse All TA-002-P Questions