Courseiva

AWS provider · topic practice

Terraform Modules practice questions

This domain covers authoring reusable Terraform modules and distributing them through registries. It is tested through scenario questions on module structure, input and output design, provider version constraints, and version pinning. You must reason about how root modules pass values into child modules and how consumers select specific published versions.

Courseiva uses original exam-style practice questions designed for learning and revision. The goal is to understand the concepts, recognise exam patterns, and improve through explanations — not memorise copied exam dumps.

Editorial oversight:Johnson Ajibi· MSc IT Security, IEEE Senior Member
20 questionsDomain: Terraform Modules

What the exam tests

What to know about Terraform Modules

Be able to author a module with clearly declared input variables and outputs, publish it to the correct registry, and consume it with a pinned version. The most important thing is defining provider version constraints in the root module, not the child module.

Choosing public versus private registry for organization-wide module sharing

Structuring variables and outputs so root modules supply values without hardcoding

Pinning a private registry module using the source address and version argument

Deciding where provider version constraints belong in module hierarchies

Watch out for

Common Terraform Modules exam traps

  • ▸Hardcoding values inside child modules instead of declaring input variables the root module can set
  • ▸Placing provider version constraints in child modules rather than the root module configuration
  • ▸Omitting the version argument when referencing a registry module, allowing unintended upgrades

Practice set

Terraform Modules questions

20 questions · select your answer, then reveal the explanation

Which THREE of the following are valid sources for a Terraform module?

If you have a module that creates an S3 bucket, and you want the bucket name to be prefixed by a value provided by the caller, how do you achieve this?

Which TWO meta-arguments can be used within a module block?

Which THREE tasks are performed by 'terraform init -upgrade'?

Question 5mediummultiple choice
Review the full subnetting walkthrough →

Your team maintains a Terraform module that provisions an AWS VPC. The module currently accepts a single string variable `cidr_block` for the VPC CIDR. You need to extend the module to support multiple CIDR blocks (e.g., for additional subnets), but you must not break existing callers that pass a single string. Which approach allows existing callers to continue working without modification while enabling the new capability?

A team wants to consume a module from a Git repository at a specific commit for reproducibility. Which two source address forms are valid and reproducible for this purpose? (Choose two.)

You maintain a module that creates an AWS Lambda function. The module exposes an output `function_arn` that is derived from the `aws_lambda_function` resource. A consumer wants to use this output in another module, but they need the value to be available even before the Lambda function is created, for planning purposes. What should you do to the output definition to satisfy this requirement?

You are authoring a module that creates an AWS EC2 instance and an associated security group. The module should allow the caller to optionally provide a list of additional security group IDs to attach to the instance. If the caller does not provide any, the instance should use only the security group created within the module. Which variable declaration and usage pattern correctly implements this optional behavior?

Question 9mediummultiple choice
Review the full subnetting walkthrough →

Your team maintains a Terraform module that provisions an AWS VPC and subnets. The module is consumed by multiple environments. You need to ensure that any future changes to the module's implementation do not break existing deployments unless explicitly upgraded. Which version constraint syntax should you use in the module block?

A team wants to distribute an internal Terraform module that is stored in an Amazon S3 bucket. The bucket is in the `us-east-1` region and contains the file `modules/vpc.zip`. Which source string correctly references this module in a `module` block?

You are creating a Terraform module that will be used by multiple teams. You want to ensure that the module is robust and follows best practices for input variables. Which two actions should you take? (Choose two.)

You are developing a module that creates an AWS Lambda function. The module should allow the caller to optionally provide a dead-letter queue (DLQ) ARN. If provided, the Lambda function should be configured with that DLQ; if not, no DLQ should be set. Which Terraform expression correctly conditionally sets the `dead_letter_config` argument?

Question 13hardmultiple choice
Review the full subnetting walkthrough →

You are using a module from the Terraform Registry that provisions an AWS RDS instance. The module requires a subnet group and security group IDs. You want to pass these from resources created in your root configuration. How should you define the module block to ensure proper dependency ordering?

Your team maintains a Terraform module that provisions an AWS Application Load Balancer (ALB) and its target groups. The module is stored in an internal Git repository and is consumed by several product teams. A product team reports that after you updated the module to add a new required variable `certificate_arn`, their `terraform plan` fails with an error about an unsupported argument. They are using the module source `git::ssh://git@internal.example.com/infra/alb-module.git?ref=v2.1.0`. You want to make the variable optional for existing consumers without changing the module's major version. What should you do?

Which directory structure is considered standard for a Terraform module?

What is the primary benefit of using a module registry compared to a local file path for module distribution?

Question 17mediummultiple choice
Read the full Terraform Modules explanation →

When refactoring a large infrastructure configuration, you move a resource into a child module. How do you handle the existing state to prevent Terraform from destroying and recreating the resource?

Question 18mediummultiple choice
Read the full Terraform Modules explanation →

You have a nested module structure. How can you pass a variable from the root module through an intermediate module to a leaf module?

You are designing a module that should conditionally create resources based on a boolean input. What feature should you use?

You need to output a complex object from a child module to be used by the root module. What is the best practice for defining the output?

Free account

Track your progress over time

Create a free account to save your results and see which topics improve across sessions.

Focused Terraform Modules sessions

Start a Terraform Modules only practice session

Every question in these sessions is drawn from the Terraform Modules domain — nothing else.

Related practice questions

Related AWS provider topic practice pages

Move into related areas when this topic feels solid.

Frequently asked questions

What does the AWS provider exam test about Terraform Modules?
Be able to author a module with clearly declared input variables and outputs, publish it to the correct registry, and consume it with a pinned version. The most important thing is defining provider version constraints in the root module, not the child module.
How should I use these practice questions?
Select your answer before revealing the explanation. Then read why each option is right or wrong — this active recall approach builds retention far faster than re-reading notes.
Can I practise just Terraform Modules questions in a focused session?
Yes — the session launcher on this page draws every question from the Terraform Modules domain. Use a 10-question session first to gauge your baseline, then move to 20 or 30 once the weak spots are clear.
Where can I practise other AWS provider topics?
Use the topic links above to move to related areas, or go back to the AWS provider question bank to see all topics.
Are these real exam questions or dumps?
These are original practice questions written to test the same concepts the AWS provider exam covers. They are not copied from any real exam or dump site.