Terraform Associate (004) · Sample questions
10 real questions from the CertifyDeck Terraform Associate (004) bank, spread across the domains of the official HashiCorp Certified: Terraform Associate (004) skills outline, with the correct answer and a full explanation of why the other options are wrong. They are original questions written from the public syllabus, not exam dumps, and they are the same style you will find in the practice tests and mock exams.
Correct answer: B. export TF_VAR_subnet_ids='["subnet-1","subnet-2"]'
Terraform reads environment variables named TF_VAR_ followed by the variable name, and complex types must be written with proper JSON-style syntax inside shell quotes, as in TF_VAR_subnet_ids='["subnet-1","subnet-2"]'. A comma-separated string is not a list expression, so it cannot convert to list(string). Without the TF_VAR_ prefix Terraform does not read the variable, and TF_VAR_subnet_ids_0 targets an undeclared variable, which Terraform ignores.
Correct answer: C. Terraform manages both, with the same workflow and a provider for each
Terraform lets you define both cloud and on-prem resources in configuration files and manage them with a consistent workflow, and providers let it work with virtually any platform that has an accessible API. Provisioners exist to run commands or scripts on a resource after creation or on destruction, but they are not how Terraform manages a platform that offers an API.
Correct answer: A. It creates random_pet.petname first and then the bucket, in one plan
The reference to random_pet.petname.id creates an implicit dependency, and Terraform uses its dependency graph to create the referenced resource first; the same workflow handles dependencies across providers. Resources are only created in parallel when they do not depend on each other, and belonging to different providers does not remove the dependency.
Correct answer: C. -backup=-
Setting the backup filename to a single dash, -backup=-, disables the creation of backup files altogether for the local backend. -state-out sets the file where new state is written, not the backup. -lock=false disables state locking and -refresh=false skips synchronising state with remote objects; neither affects backups.
Correct answer: B. "${path.module}/templates/user_data.tftpl"
path.module is the filesystem path of the module where the expression is placed, so inside the child it points to the child's own folder. path.root is the path of the root module and path.cwd is the current working directory, so both resolve relative to the caller rather than to the child. terraform.workspace holds the name of the selected workspace, not a filesystem path.
Correct answer: B. Run terraform plan repeatedly as you edit the files
HashiCorp suggests repeatedly running plans while authoring, which flushes out syntax errors and shows the intended changes, because terraform plan never changes real infrastructure. terraform apply -auto-approve and destroy followed by apply both modify infrastructure, which the requirement rules out, and init -upgrade only updates providers and modules.
Correct answer: B. A run trigger in app with networking as the source workspace
A run trigger connects a workspace to source workspaces so that a run queues automatically in it whenever a source workspace applies successfully. A terraform_remote_state data source reads outputs but does not start runs, auto-apply in networking only affects networking runs, and VCS trigger patterns react to commits in the workspace own repository.
Correct answer: A. provider = aws.west
The import block accepts the provider meta-argument, which selects a non-default provider configuration by its alias, such as provider = aws.west. The providers map belongs to module blocks, alias is set inside the provider block itself, and depends_on declares dependencies rather than choosing a provider configuration; none of them is an import block argument.
Correct answer: B. alias
You create multiple configurations of one provider by repeating the provider block and giving each additional block a unique alias, which resources then select as <PROVIDER_NAME>.<ALIAS>. The version argument in a provider block is a deprecated version constraint, source belongs to the required_providers entry, and configuration_aliases is declared in required_providers by a module that expects to receive aliased configurations.
Correct answer: D. An implied empty default configuration for the provider
When every provider block for a provider uses an alias, Terraform creates an implied empty default configuration and any resource without the provider meta-argument uses it; if the provider has required arguments, Terraform returns an error. Terraform never picks an aliased block by position or name, and the provider pointer kept in state is metadata for objects already managed, not a way to choose a configuration for a new resource.
Answer each question before opening the explanation, and write down why you discarded the other options. On Terraform Associate (004), most mistakes come from choosing an option that is technically possible but does not meet every requirement in the scenario.
These 10 questions are a taste of the format, not a diagnostic. To know which domains you fail, practice by domain for free and take a timed mock exam that mirrors the official weights and duration.
Start for free, no sign-up or card. Every question includes an explanation like the ones above, and the mock exam reproduces the official Terraform Associate (004) format.