QuizzesTerraform Modules: Mastering Basic Infrastructure Automation
beginner
terraform

Terraform Modules: Mastering Basic Infrastructure Automation

An introductory quiz on using Terraform modules for infrastructure automation.

15 minutes 15 questions Pass at 70%
Time Limit
15 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

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. 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. 2.Which file is typically used to define a Terraform module?

    • Amain.tf
    • Boutputs.tf
    • Cmodule.tf
    • Dvariables.tf
  3. 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. 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. 5.Which of the following is NOT a valid source for a Terraform module?

    • AGit repository
    • BDocker Hub
    • CTerraform Registry
    • DLocal directory
  6. 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. 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. 8.Which command initializes a Terraform module?

    • Aterraform init
    • Bterraform validate
    • Cterraform plan
    • Dterraform apply
  9. 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. 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. 11.What is the benefit of using modules in Terraform?

    • AIncreased code duplication
    • BSlower deployment times
    • CSimplified resource management
    • DReduced code readability
  12. 12.Which file is used to specify outputs in a Terraform module?

    • Amodule.tf
    • Bvariables.tf
    • Coutputs.tf
    • Dmain.tf
  13. 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. 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. 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