Terraform Modules: Mastering Basic Infrastructure Automation
An introductory quiz on using Terraform modules for infrastructure automation.
Questions in this quiz
15 questions on Terraform Modules: Mastering Basic Infrastructure Automation. Work through them here, then start the quiz to answer them and see your score.
1.What is the primary purpose of a Terraform module?
- ATo execute Terraform code
- BTo manage Terraform providers
- CTo group resources together for reuse
- DTo store Terraform state
2.Which file is typically used to define a Terraform module?
- Amain.tf
- Boutputs.tf
- Cmodule.tf
- Dvariables.tf
3.How do you call a module in a Terraform configuration?
- Ainclude "path/to/module"
- Bmodule { source = "path/to/module" }
- Cuse "path/to/module"
- Dimport "path/to/module"
4.What is the purpose of the 'source' argument in a module block?
- ATo define the module's output
- BTo specify the module's version
- CTo set the module's variables
- DTo indicate where the module is located
5.Which of the following is NOT a valid source for a Terraform module?
- AGit repository
- BDocker Hub
- CTerraform Registry
- DLocal directory
6.What is the purpose of the 'variables.tf' file in a module?
- ATo store module outputs
- BTo define input variables for the module
- CTo configure module dependencies
- DTo specify module resources
7.How can you output values from a Terraform module?
- AUsing the 'print' function
- BUsing the 'output' block
- CUsing the 'return' statement
- DUsing the 'export' command
8.Which command initializes a Terraform module?
- Aterraform init
- Bterraform validate
- Cterraform plan
- Dterraform apply
9.How can you pass variables to a Terraform module?
- AUsing the 'module' block
- BUsing the 'input' block
- CUsing the 'variable' block
- DUsing the 'var' block
10.What is the default behavior if a module does not find a required variable?
- AIt prompts the user for input
- BIt uses a default value
- CIt skips the variable
- DIt throws an error
11.What is the benefit of using modules in Terraform?
- AIncreased code duplication
- BSlower deployment times
- CSimplified resource management
- DReduced code readability
12.Which file is used to specify outputs in a Terraform module?
- Amodule.tf
- Bvariables.tf
- Coutputs.tf
- Dmain.tf
13.How do you specify a version constraint for a module from the Terraform Registry?
- Aversion = "1.0.0"
- Bsource = "module@1.0.0"
- Csource = "module:1.0"
- Dversion = "~> 1.0"
14.What command do you use to see the changes that will be applied by a module?
- Aterraform plan
- Bterraform destroy
- Cterraform init
- Dterraform apply
15.Which of the following is a best practice when using Terraform modules?
- AAvoid using variables
- BStore state files in the module directory
- CHardcode all values
- DUse version control for modules