0
0
Terraformcloud~20 mins

Why modules enable reusability in Terraform - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Terraform Module Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
How do Terraform modules improve code reusability?

Which statement best explains why Terraform modules enable reusability?

AModules automatically update cloud resources without any input changes.
BModules are only used for storing variables and do not affect resource creation.
CModules package configuration into reusable units that can be called multiple times with different inputs.
DModules prevent any changes to infrastructure once deployed.
Attempts:
2 left
💡 Hint

Think about how grouping code helps avoid repeating the same instructions.

Architecture
intermediate
2:00remaining
Using modules to deploy multiple similar resources

You want to deploy three virtual machines with similar settings but different names and IPs. How can Terraform modules help?

AModules cannot be used for multiple similar resources; use loops instead.
BWrite three separate resource blocks without modules to keep it simple.
CUse a module only once and manually copy its output to create other VMs.
DCreate one module defining a VM and call it three times with different input variables for name and IP.
Attempts:
2 left
💡 Hint

Think about how calling the same code with different inputs saves effort.

Configuration
advanced
2:00remaining
What output does this Terraform module call produce?

Given the module call below, what is the value of module.webserver.instance_count after applying?

Terraform
module "webserver" {
  source = "./modules/server"
  instance_count = 3
  server_name = "web-prod"
}

output "instance_count" {
  value = module.webserver.instance_count
}
A0
B3
Cnull
DError: output not found
Attempts:
2 left
💡 Hint

Check how the input variable instance_count is passed and output is defined.

security
advanced
2:00remaining
How do modules help improve security in Terraform projects?

Which option best describes how using modules can enhance security in Terraform infrastructure code?

AModules allow centralizing sensitive configurations, reducing exposure and mistakes across multiple resources.
BModules automatically encrypt all variables and outputs without extra configuration.
CModules prevent unauthorized users from running Terraform commands.
DModules disable logging to avoid exposing sensitive data.
Attempts:
2 left
💡 Hint

Think about how reusing code can reduce errors and improve control.

service_behavior
expert
3:00remaining
What happens when a module is updated and re-applied?

You have a Terraform module used in multiple places. You update the module code to change a resource property. What is the expected behavior when you run terraform apply in a project using this module?

ATerraform detects the change and updates the affected resources accordingly during apply.
BTerraform ignores module changes unless you delete and re-add the module block.
CTerraform throws an error and refuses to apply changes from updated modules.
DTerraform automatically creates new resources but does not modify existing ones.
Attempts:
2 left
💡 Hint

Consider how Terraform tracks resource state and module code.