Public practice sampler

Terraform Associate 004: Free knowledge assessment

Try eight original Terraform Associate 004 practice questions, review objective-specific explanations and write a small HCL example before comparing a reference solution.

Practice eight Terraform concepts at your own pace, review your answers and build a small configuration.

1. Check your knowledge

Loading the public practice questions...

2. Construct a small configuration

Write HCL that declares a string input named environment and an output named label whose value combines that input with the literal suffix -catalog. Use invented values only. For input dev, the expected label is dev-catalog.

main.tfTerraform ยท HCL
Need a conceptual hint?

Declare the input in a variable block. The var namespace references its value; an output block exposes a derived expression. Consider how interpolation combines a value and a literal string.

Compare a reference example after attempting
variable "environment" {
  type = string
}

output "label" {
  value = "${var.environment}-catalog"
}

Check that the variable has the intended name and type, the output uses the input rather than a fixed value, and the suffix is preserved. Compare your own approach with the reference example.

3. Transfer and revisit

Explain why changing the input changes the output. Later, without looking at the example, write a new configuration that accepts a service name and returns a label with a different suffix. Use the native Terraform contract testing example to investigate how behavior can be tested separately.

Continue your learning

Use the feedback to choose an objective to revisit. Read the learning methodology, explore the Associate 004 study roadmap or continue with the certification practice path.

Official reference

HashiCorp: Terraform Associate 004 exam content list. Confirm current exam objectives and version before preparing for the official examination.

Practice infrastructure change analysis in the Terraform Plan Review Challenge.