In Terraform, module variable assignments are inherited from the parent module and do not need to be explicitly set.

Prepare for the HashiCorp Terraform Associate Exam. Utilize flashcards and multiple-choice questions with detailed hints and explanations. Boost your confidence and be ready for success!

Multiple Choice

In Terraform, module variable assignments are inherited from the parent module and do not need to be explicitly set.

Explanation:
Module input variables are not inherited from the parent automatically; you must pass values to the child module explicitly. Each module defines its own set of input variables, and the child can only access those inputs if you provide them when calling the module. If a variable in the child module has no default value and you don’t supply it, Terraform will raise an error during plan or apply. You can supply values by adding arguments in the module block of the parent, for example: module "network" { source = "./modules/network" vpc_id = var.network_vpc_id }. If the child’s variable has a default, you can omit it and Terraform will use that default. You can also provide values via environment variables (TF_VAR_*) or through Terraform Cloud workspace variables, but there is still no automatic inheritance from the parent to the child—you must specify the values (or rely on defaults) explicitly.

Module input variables are not inherited from the parent automatically; you must pass values to the child module explicitly. Each module defines its own set of input variables, and the child can only access those inputs if you provide them when calling the module. If a variable in the child module has no default value and you don’t supply it, Terraform will raise an error during plan or apply.

You can supply values by adding arguments in the module block of the parent, for example: module "network" { source = "./modules/network" vpc_id = var.network_vpc_id }. If the child’s variable has a default, you can omit it and Terraform will use that default. You can also provide values via environment variables (TF_VAR_*) or through Terraform Cloud workspace variables, but there is still no automatic inheritance from the parent to the child—you must specify the values (or rely on defaults) explicitly.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy