terraform-associate-003 Free Sample Questions

HashiCorp Certified: Terraform Associate (003) Practice Test
10/207 questions · Unlock full access
Q1

A financial services company is using Terraform to manage a multi-tenant environment where each tenant's infrastructure is defined in a separate module. To ensure strict isolation and prevent accidental cross-tenant modifications, the lead architect has mandated that each module invocation must use a unique provider configuration with tenant-specific credentials. How can this be achieved within the root module?

Q2

A DevOps team is managing a large-scale application on AWS using Terraform. They have a module that creates an S3 bucket with logging enabled. The logging bucket must be created in a separate security account. The team has configured two AWS provider instances in their root module: one default and one with an alias `security`. How must they configure the S3 bucket module to ensure the main bucket uses the default provider and the logging bucket uses the `security` provider?

Q3

A Terraform configuration contains the following code: ```hcl locals { instances = { "web-1" = { type = "t3.medium", zone = "us-east-1a" } "app-1" = { type = "m5.large", zone = "us-east-1b" } } } resource "aws_instance" "server" { for_each = local.instances ami = "ami-0c55b159cbfafe1f0" instance_type = each.value.type availability_zone = each.value.zone } ``` How would you reference the availability zone of the `app-1` instance in an output value?

Q4

True or False: Using the `terraform state replace-provider` command is the recommended method for upgrading a provider to a new major version within your configuration.

Q5

A team is building a reusable Terraform module to create a web application stack. They want to allow consumers of the module to optionally define a set of firewall rules. Each rule is an object with `protocol`, `from_port`, `to_port`, and `cidr_blocks`. Which Terraform language feature should be used to dynamically generate the `ingress` blocks for the security group resource based on a variable list of rule objects?

Q6

A developer is writing a Terraform configuration and needs to ensure that a variable `instance_count` is always a positive integer greater than zero. Which of the following code blocks correctly implements this validation?

Q7Multiple answers

Which of the following are valid sources for a Terraform module in a `module` block? (Select TWO)

Q8

A CI/CD pipeline running on a Linux agent executes `terraform plan`. The same configuration, when planned on a developer's macOS laptop, shows no changes. However, the pipeline's plan shows a provider version change and wants to update the lock file. What is the most likely cause of this discrepancy?

Q9

A new team member runs `terraform plan` and receives an error message: `Error: Missing required argument`. The missing argument is for a resource that is created by a colleague's configuration in a separate directory. The team is using a shared remote state backend. What is the most effective way to resolve this error?

Q10

When working with HCP Terraform, what is the primary purpose of a workspace?