Infrastructure as Code with Terraform: the core workflow, configuration, modules, state management, and HCP Terraform, for practitioners proving day-to-day Terraform fluency.
Exam domains and weighting
The TF-Associate-004 blueprint is split across 8 domains. See the official exam guide for the authoritative breakdown.
Free sample questions
No account needed. Every question explains why every answer is right or wrong, just like the full bank.
lock_openFree sampleTerraform state managementeasy
A practitioner runs 'terraform apply' in a new directory that contains only 'main.tf', with no 'backend' or 'cloud' block declared. After the apply succeeds, where does Terraform record the resulting state by default?
terraform {
required_providers {
local = {
source = "hashicorp/local"
}
}
}
resource "local_file" "note" {
filename = "${path.module}/note.txt"
content = "hello"
}
- AIn a file named 'terraform.tfstate' in the current working directory, using the local backend.check_circle Correct
- BIn HCP Terraform, because any workspace is automatically linked to the remote state service.
- CIn the provider's own datastore, since the 'local' provider manages where state is persisted.
- DNowhere on disk, because state is held only in memory until a backend is added.
When no backend is configured, Terraform defaults to the local backend and stores state in terraform.tfstate on disk. The local backend is Terraform's built-in default. When neither a 'backend' nor a 'cloud' block is present, Terraform persists the working state to a file called terraform.tfstate in the current directory after every successful operation.
Why A is correct: With no backend or cloud block configured, Terraform uses the local backend by default and writes state to 'terraform.tfstate' in the working directory.
Why B is wrong: HCP Terraform is only used when a 'cloud' block is present; without one Terraform never links a workspace to a remote service, so this is wrong.
Why C is wrong: It is tempting to conflate the 'local' provider with the local backend, but providers manage resources and never decide where state is stored.
Why D is wrong: Terraform always persists state after an apply; the default local backend writes it to disk immediately rather than keeping it only in memory.
lock_openFree sampleInfrastructure as Code (IaC) with Terraformeasy
A team has been provisioning identical staging and production environments by clicking through the cloud console by hand, and the two environments keep ending up subtly different. They decide to define the whole environment once as Terraform configuration and apply it to each environment. Which advantage of IaC most directly addresses their problem?
- AFaster raw provisioning speed, because Terraform always creates cloud resources more quickly than the console does.
- BRepeatability, because applying the same configuration produces the same environment every time it is run.check_circle Correct
- CAutomatic cost reduction, because Terraform selects the cheapest resource sizes on the team's behalf.
- DElimination of the need for any cloud provider credentials during provisioning.
Repeatability means applying the same Terraform configuration reliably reproduces the same environment, removing manual inconsistency. Because the environment is expressed as code and Terraform converges real infrastructure to that declared configuration, reapplying the same files yields the same result each time, which is the mechanism that keeps staging and production identical.
Why A is wrong: Speed can improve, but Terraform is not guaranteed to be faster than the console, and speed is not what fixes environments that differ from each other.
Why B is correct: Defining the environment as code and reapplying it gives a repeatable, reproducible build, which is exactly what removes the subtle differences between the two environments.
Why C is wrong: Terraform provisions whatever sizes the configuration specifies and does not choose cheaper options by itself, so this does not address inconsistency.
Why D is wrong: Terraform still authenticates to the provider with credentials to make changes, so this is factually wrong and unrelated to environment consistency.
lock_openFree sampleHCP Terraformmedium
A platform team wants every run in an HCP Terraform workspace to be blocked from applying if a proposed AWS security group opens port 22 to the whole internet. They want this enforced automatically as part of the run, before the apply stage. Which HCP Terraform feature should they use?
# proposed change flagged during plan
resource "aws_security_group_rule" "ssh" {
type = "ingress"
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
- AA policy as code check using Sentinel or OPA, attached to the workspace so it evaluates the plan between the plan and apply stages.check_circle Correct
- BThe cost estimation feature, which inspects the plan and refuses to apply resources that create a security risk.
- CA private module registry constraint that rejects any module publishing a rule with an open CIDR block.
- DA workspace run trigger that fires a downstream workspace to revert the offending rule after the apply completes.
Policy as code with Sentinel or OPA in HCP Terraform enforces governance rules against a plan and can block an apply. HCP Terraform evaluates attached Sentinel or OPA policy sets against the plan output during the run, and a hard-mandatory policy that fails prevents the apply stage from proceeding, which is precisely the automated gate the team needs.
Why A is correct: Sentinel and OPA are HCP Terraform's policy as code engines; a policy set attached to the workspace runs against the plan and can produce a hard-mandatory failure that blocks the apply.
Why B is wrong: Cost estimation is a genuine HCP Terraform feature and runs at a similar point in the run, which makes it tempting, but it only reports projected spend and never blocks a run for a security condition.
Why C is wrong: The private registry hosts and versions shared modules and providers, so it sounds governance related, but it does not evaluate the contents of a plan or enforce rules at run time.
Why D is wrong: Run triggers do chain workspaces together, which feels like automation, but they act after a run finishes and cannot prevent the risky apply from happening in the first place.
More free TF-Associate-004 practice questions, every answer explainedFrequently asked questions
- How many questions are on the Terraform Associate exam?
- The HashiCorp Certified: Terraform Associate (TF-Associate-004) exam has Not published by HashiCorp questions and runs for 60 minutes. The format is online proctored, multiple choice.
- What score do I need to pass Terraform Associate?
- HashiCorp does not publish a fixed pass mark for Terraform Associate, so treat any "X%" figure you see elsewhere as unofficial. Examworthy gives you a per-domain readiness score so you can judge when you are ready across every domain.
- How much does the Terraform Associate exam cost?
- The exam costs 70.5 USD to sit. Practising on Examworthy is free to start, and every answer is explained, right and wrong.
- Is there a Terraform Associate practice exam?
- Yes. Examworthy's exam mode runs a timed Terraform Associate practice exam (mock) paced to match the real exam, scored per domain so you can see exactly where you stand. Timed mocks are free with an account.
- How does Examworthy help me prepare for Terraform Associate?
- Every practice question explains why the right answer is right and why each wrong one is wrong, mapped to the official blueprint domains. You learn the reasoning, not just the letter.
- Is Examworthy affiliated with HashiCorp?
- No. Examworthy is not affiliated with or endorsed by HashiCorp. Our questions are original, blueprint-aligned practice material; we never reproduce live exam items.
Examworthy is not affiliated with or endorsed by HashiCorp. All questions are original, blueprint-aligned practice material. We never reproduce live exam items. TF-Associate-004 and related marks belong to their respective owners.