フリー問題

HashiCorp Certified: Terraform Associate (004) のフリー問題 11 / 20 問目

問題文

A module accepts an object with several attributes, and the author wants callers to be able to omit two of them and get sensible defaults. Which mechanism fits?

選択肢

  1. Declare a separate variable for each optional attribute with its own default, and assemble the object inside the module.
  2. Mark those attributes as optional in the object type constraint and give each one a default value there.
  3. Use a map type instead of an object type, and merge the caller's map with a map of defaults inside the module, since object types require every attribute to be present and cannot express optionality.
  4. Give the whole variable a default value that contains the two attributes, so callers who omit them get those values.

解答・解説を確認するには

正解と解説の確認、回答の記録には無料登録が必要です。登録すると演習モードでフリー問題に回答し、正誤と解説をその場で確認できます。