In Terraform, what does the term root module refer to?
Think about where Terraform starts reading your configuration files.
The root module is the main directory where Terraform loads configuration files to start the deployment process. It is the entry point for Terraform execution.
When a root module calls a child module, how does Terraform treat the child module?
Consider how Terraform manages state for modules called inside other modules.
Child modules are included in the root module's state but are logically separated to organize resources. They do not have independent state files.
Given this root module code snippet, what will be the value of the output instance_name?
module "web_server" { source = "./modules/server" name = "app-server" } output "instance_name" { value = module.web_server.name }
Look at how the module input name is passed and then output is referencing it.
The module is called with name = "app-server". The output references module.web_server.name, so the output value is "app-server".
When managing sensitive data in a root module, which practice is best to keep secrets safe?
Think about how to avoid exposing secrets in code or outputs.
Using environment variables or secret management tools keeps sensitive data out of code and state files, improving security.
If the Terraform state file for the root module is deleted, what is the expected behavior when running terraform apply again?
Consider how Terraform uses the state file to track resources.
Terraform relies on the state file to know what resources exist. Without it, Terraform assumes no resources exist and tries to create them again.