試験Terraform-Associate-004 トピック4 問題272 スレッド
HashiCorp Terraform-Associate-004のリアル試験問題集
問題 #: 272
トピック #: 4
問題 #: 272
トピック #: 4
Exhibit:
module " web_stack " {
source = " ./modules/web_stack "
}
Your configuration defines the module block shown in the exhibit. The web_stack module accepts an input variable named servers. Which of the following changes to the module block sets the servers variable to the value of 3?
module " web_stack " {
source = " ./modules/web_stack "
}
Your configuration defines the module block shown in the exhibit. The web_stack module accepts an input variable named servers. Which of the following changes to the module block sets the servers variable to the value of 3?
おすすめの解答:C 解答を投票する
Detailed Explanation:
* Rationale for Correct Answer: Module input variables are set by providing arguments in the module block whose names match the module's declared variables. Since the module expects servers, you pass it directly as servers = 3. This is the standard Terraform module input pattern.
* Analysis of Incorrect Options (Distractors):
* A: Incorrect. var.servers is how you reference an input variable in expressions, not how you assign a module input. Module inputs are set as arguments, not through the var. namespace.
* B: Incorrect. Terraform module blocks do not use an inputs = { ... } argument (that pattern is common in some other tools, but not Terraform).
* D: Incorrect. inputs.servers is not valid HCL syntax for setting module input arguments.
* Key Concept: Passing input variables to modules by setting arguments on the module block.
Reference: Interact with Terraform Modules - module input variables and how they're assigned in a module block.
* Rationale for Correct Answer: Module input variables are set by providing arguments in the module block whose names match the module's declared variables. Since the module expects servers, you pass it directly as servers = 3. This is the standard Terraform module input pattern.
* Analysis of Incorrect Options (Distractors):
* A: Incorrect. var.servers is how you reference an input variable in expressions, not how you assign a module input. Module inputs are set as arguments, not through the var. namespace.
* B: Incorrect. Terraform module blocks do not use an inputs = { ... } argument (that pattern is common in some other tools, but not Terraform).
* D: Incorrect. inputs.servers is not valid HCL syntax for setting module input arguments.
* Key Concept: Passing input variables to modules by setting arguments on the module block.
Reference: Interact with Terraform Modules - module input variables and how they're assigned in a module block.
Sugimoto 2026-10-16 04:59:54
コメント
他人の解答コメントを賛成するのも、その解答に一票を入れることになります。したがって、すでに同じ意見の投票コメントが存在する場合、新規コメントをする代わりに賛成することもできます。
コメントを通報する
コメント中
今すぐ 新規登録 / ログイン (無料です)。