yoklainterview sim

DevOps / Cloud Terraform Modules Workspaces Interview Questions

75 verified DevOps / Cloud Terraform Modules Workspaces interview questions — solve with answers, learn from explanations, test yourself in a real simulation.

Try the real simulation →

Sample questions

Terraform Modules WorkspacesDifficulty 1
In Terraform, what is a module?
  • aA single provider block that configures cloud credentials
  • bA reusable container that groups related resources together
  • cA remote server that runs terraform apply on a schedule
  • dA file that only stores the state of previously applied resources
Explanation:A module is a container for one or more resource blocks (plus variables/outputs) that are grouped and used together as a reusable unit, so the same infrastructure pattern can be instantiated multiple times without copy-pasting resource definitions.
Terraform Modules WorkspacesDifficulty 1
What is the 'root module' in a Terraform configuration?
  • aThe configuration in the directory where Terraform commands are run
  • bThe very first module ever published to the Terraform Registry
  • cA module that can never contain any resource blocks, only module calls
  • dThe module that stores the remote state backend credentials
Explanation:The root module is the Terraform configuration in the directory where you run terraform commands. It is the entry point of an execution: it can define resources directly and/or call other modules (child modules) via module blocks.
Terraform Modules WorkspacesDifficulty 1
What is the conventional minimal file layout for a reusable Terraform module?
  • aA single all.tf file containing everything, since Terraform does not support splitting configuration across files
  • bprovider.tf, backend.tf, and state.tf only
  • cmain.tf (resources), variables.tf (input variables), and outputs.tf (output values)
  • dindex.tf, package.json, and README.md, mirroring a typical npm package layout
Explanation:By convention (not a hard requirement — Terraform loads all .tf files in a directory), a reusable module is organized as main.tf for resources, variables.tf for its input variables, and outputs.tf for its output values, making the module's public interface easy to find.
Terraform Modules WorkspacesDifficulty 1
What is the purpose of a variable block inside a module?
  • aTo hardcode a fixed value that callers of the module can never change
  • bTo define an input the module accepts
  • cTo store the module's current state file location
  • dTo declare which cloud provider the module is allowed to run against
Explanation:A variable block declares an input parameter for the module. The caller of the module supplies a value for it (in the module block's arguments), which lets the same module be reused with different settings across environments or resources.
Terraform Modules WorkspacesDifficulty 1
What is the purpose of an output block inside a module?
  • aTo print debug information to the terminal during terraform plan only
  • bTo define which provider version the module requires
  • cTo permanently delete a resource once it is no longer needed
  • dTo expose a value from inside the module for outside reference
Explanation:An output block exposes a value computed inside the module (such as a resource's generated ID or ARN) so that the root module, or another module wired to it, can reference that value — this is how information flows back out of a module.
Terraform Modules WorkspacesDifficulty 1
Consider this snippet:
module "network" {
  source = "./modules/network"
  cidr   = "10.0.0.0/16"
}

What does this do?
  • aCalls the local module at ./modules/network, passing a cidr input value
  • bDefines a new provider named network with a fixed CIDR range
  • cDownloads a module named network from the public Terraform Registry
  • dCreates a resource of type module with the id network
Explanation:A module block instantiates a module: source tells Terraform where to find its configuration (here, a local relative path), and any other arguments (like cidr) are passed in as values for that module's declared input variables.

Test yourself against the 3375-question DevOps / Cloud bank.

Start interview