Terraform Associate Modules and Workspaces Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Thames
T
Thames
Community Contributor
Quizzes Created: 11982 | Total Attempts: 187,298
| Attempts: 12 | Questions: 20 | Updated: Aug 16, 2026
Please wait...
Question 1 / 21
🏆 Rank #-- ▾
0 %
0/100
Score 0/100

1. Which command lists all existing workspaces?

Explanation

Terraform’s `workspace list` subcommand displays all workspaces configured for the current working directory and marks the currently selected workspace with an asterisk. The other options are not valid commands for listing workspaces.

Submit
Please wait...
About This Quiz
Terraform Associate Modules and Workspaces Quiz - Quiz

This quiz evaluates your understanding of Terraform modules and workspaces, two critical components for organizing and managing infrastructure code. Modules enable code reusability and maintainability, while workspaces support managing multiple environments. Ideal for professionals preparing for the Terraform Associate certification.

2.

What first name or nickname would you like us to use?

You may optionally provide this to label your report, leaderboard, or certificate.

2. Module variables can have default values defined in variables.tf.

Explanation

In Terraform, module input variables are commonly declared in a `variables.tf` file. A variable can include a `default` value, which Terraform uses when the module caller does not provide one. The caller can still supply a different value to override that default.

Submit

3. Workspaces are useful for managing development, staging, and production environments.

Explanation

Workspaces let teams organize separate environments—such as development, staging, and production—so each can use its own resources and settings. This separation helps prevent changes or testing in one environment from affecting another and makes deployments easier to manage.

Submit

4. A Terraform module must be stored in a separate GitHub repository.

Explanation

Terraform modules do not have to be stored in separate GitHub repositories. They can be organized in directories within the same repository, or sourced from places such as the Terraform Registry, GitHub, or other remote locations. A separate repository is simply one possible way to share and manage a module.

Submit

5. Which of these is NOT typically included in a module's outputs.tf file?

Explanation

A module’s `outputs.tf` file typically exposes useful values such as resource IDs, endpoints, database connection strings, or load balancer addresses for other configurations to use. AWS access keys are credentials and should not be exposed as module outputs; they should be managed securely through appropriate secret-management tools or environment-specific credential mechanisms.

Submit

6. What command switches between workspaces in Terraform?

Explanation

`terraform workspace select ` switches Terraform to an existing workspace, letting you work with that workspace’s separate state. For example, `terraform workspace select staging` selects the `staging` workspace.

Submit

7. How do you reference an output from a module in your root configuration?

Explanation

In Terraform, reference a child module’s output with `module..`. Use the module’s name from its `module` block and the output name declared inside that module—for example, `module.network.vpc_id`. This makes the output available to expressions in the root configuration.

Submit

8. What is the scope of a workspace's state file in Terraform?

Explanation

Each Terraform workspace maintains its own state file, tracking the resources managed within that workspace. This isolation lets multiple environments, such as development and production, use the same configuration without sharing or overwriting each other’s state.

Submit

9. In a module, how do you expose values to the calling configuration?

Explanation

Output blocks in `outputs.tf` make selected values from a module available to the configuration that calls it. The caller can reference these values using the module’s output attributes, such as `module.example.output_name`.

Submit

10. What file in a module typically declares the required input variables?

Explanation

In a Terraform module, `variables.tf` typically contains `variable` blocks that define the module’s input variables, along with their types, descriptions, and optional defaults. This helps document and validate the values callers can provide when using the module.

Submit

11. How do you pass variables to a Terraform module?

Explanation

Variables are passed to a Terraform module by assigning values to its input variables in the module block. The module must declare those inputs, typically in a `variables.tf` file, and the calling configuration supplies the values as arguments when invoking it.

Submit

12. What is the default workspace name in Terraform?

Explanation

Terraform uses the workspace named `default` automatically when a new working directory is initialized. Workspaces let you manage separate state instances for the same configuration, and `default` remains the active workspace unless you create and select another one.

Submit

13. Which of the following is a benefit of using modules in Terraform?

Explanation

Terraform modules let you package configuration into reusable components and use them across multiple projects or environments. This avoids repeating the same resource definitions, making configurations easier to maintain, update, and keep consistent. Modules do not automatically back up state, provide disaster recovery, or eliminate all configuration errors.

Submit

14. How do you create a new workspace in Terraform?

Explanation

Run `terraform workspace new ` to create a workspace and switch to it. Replace the placeholder with the name you want, such as `dev`. Terraform workspaces let you manage separate state instances for the same configuration, so changes and resources tracked in one workspace remain distinct from those in another. Initialize the directory first if needed.

Submit

15. In Terraform, what does a workspace allow you to do?

Explanation

A Terraform workspace provides an isolated state file for each environment, such as development, staging, or production. This lets you manage multiple instances of the same configuration separately without changing or duplicating the infrastructure code.

Submit

16. What is the correct syntax to call a module in Terraform?

Explanation

Terraform modules are declared with a `module` block. The block label gives the module instance its name, and the `source` argument specifies where Terraform should find the module, such as a local path or registry address.

Submit

17. What is the primary purpose of a Terraform module?

Explanation

A Terraform module packages related resources, variables, and outputs into a reusable unit. This helps keep configurations organized and lets teams apply the same infrastructure patterns across projects without duplicating code. State storage, multi-region management, and provider authentication are handled through other Terraform features or configuration.

Submit

18. When you delete a workspace, all resources managed by that workspace are automatically destroyed.

Explanation

Deleting a workspace removes its associated configuration or state context, but it does not automatically destroy the infrastructure that was created from it. Those resources may continue running and incur costs until they are explicitly destroyed through the appropriate process.

Submit

19. A module source can reference which of the following? Select all that apply.

Submit

20. Which directory structure is required for a Terraform module?

Explanation

A well-organized Terraform module commonly includes main.tf for resources, variables.tf for configurable inputs, outputs.tf for values exposed to callers, and README.md documenting usage, inputs, and outputs. This layout makes the module easier to understand, reuse, and maintain. Terraform does not strictly enforce these exact filenames, but they form a conventional structure for a clear, reusable module.

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (20)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Which command lists all existing workspaces?
Module variables can have default values defined in variables.tf.
Workspaces are useful for managing development, staging, and...
A Terraform module must be stored in a separate GitHub repository.
Which of these is NOT typically included in a module's outputs.tf...
What command switches between workspaces in Terraform?
How do you reference an output from a module in your root...
What is the scope of a workspace's state file in Terraform?
In a module, how do you expose values to the calling configuration?
What file in a module typically declares the required input variables?
How do you pass variables to a Terraform module?
What is the default workspace name in Terraform?
Which of the following is a benefit of using modules in Terraform?
How do you create a new workspace in Terraform?
In Terraform, what does a workspace allow you to do?
What is the correct syntax to call a module in Terraform?
What is the primary purpose of a Terraform module?
When you delete a workspace, all resources managed by that workspace...
A module source can reference which of the following? Select all that...
Which directory structure is required for a Terraform module?
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!