0
0
Terraformcloud~20 mins

Root module concept in Terraform - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Terraform Root Module Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the root module in Terraform?

In Terraform, what does the term root module refer to?

AA module that is automatically created by Terraform for each provider.
BA special Terraform module that manages remote state storage.
CThe directory where Terraform configuration files are loaded and executed by default.
DA module that contains only variables and no resources.
Attempts:
2 left
💡 Hint

Think about where Terraform starts reading your configuration files.

Architecture
intermediate
2:00remaining
How does Terraform handle nested modules called from the root module?

When a root module calls a child module, how does Terraform treat the child module?

AAs a separate module with its own state, isolated from the root module.
BAs part of the root module's configuration and state, but logically separated.
CAs a completely independent Terraform project requiring separate initialization.
DAs a provider plugin that manages resources automatically.
Attempts:
2 left
💡 Hint

Consider how Terraform manages state for modules called inside other modules.

Configuration
advanced
2:00remaining
What is the output of this Terraform root module configuration?

Given this root module code snippet, what will be the value of the output instance_name?

Terraform
module "web_server" {
  source = "./modules/server"
  name   = "app-server"
}

output "instance_name" {
  value = module.web_server.name
}
A"app-server"
B"web_server"
Cnull
DSyntaxError: output value must be a string
Attempts:
2 left
💡 Hint

Look at how the module input name is passed and then output is referencing it.

security
advanced
2:00remaining
Which practice improves security when using root modules in Terraform?

When managing sensitive data in a root module, which practice is best to keep secrets safe?

AHardcoding secrets directly in the root module variables.tf file.
BIncluding secrets in output blocks to easily access them after deployment.
CStoring secrets in plain text files inside the root module directory.
DUsing environment variables or secret management tools to inject sensitive values.
Attempts:
2 left
💡 Hint

Think about how to avoid exposing secrets in code or outputs.

service_behavior
expert
2:00remaining
What happens if the root module's Terraform state file is deleted accidentally?

If the Terraform state file for the root module is deleted, what is the expected behavior when running terraform apply again?

ATerraform will recreate all resources because it thinks none exist.
BTerraform will detect existing resources and import them automatically without changes.
CTerraform will fail with an error saying state file is missing and stop execution.
DTerraform will ignore the missing state and only update resources defined in child modules.
Attempts:
2 left
💡 Hint

Consider how Terraform uses the state file to track resources.