HashiCorp Certified: Terraform Associate (004) Terraform-Associate-004 HCTA0-004 Exam Questions

Page: 1 / 14
Total 301 questions
Question 1

Which of the following ate advantages of using infrastructure as code (laC) instead of provisioning with a graphical user interface (GUI)? Choose two correct answers.



Answer : A, D

It lets you version, reuse, and share infrastructure configuration as code files, which can be stored in a source control system and integrated with your CI/CD pipeline.

It reduces risk of operator error by automating repetitive tasks and ensuring consistency across environments. IaC does not necessarily provision resources at a lower cost, secure your credentials, or prevent manual modifications to your resources - these depend on other factors such as your cloud provider, your security practices, and your access policies.


Question 2

How does Terraform manage most dependencies between resources?



Answer : A

This is how Terraform manages most dependencies between resources, by using the references between them in the configuration files. For example, if resource A depends on resource B, Terraform will create resource B first and then pass its attributes to resource A.


Question 3

You can reference a resource created with for_each using a Splat ( *) expression.



Answer : B

You cannot reference a resource created withfor_eachusing a splat (*) expression, as it will not work with resources that have non-numeric keys. You need to use aforexpression instead to iterate over the resource instances.


Question 4

What kind of configuration block will create an infrastructure object with settings specified within the block?



Answer : D

This is the kind of configuration block that will create an infrastructure object with settings specified within the block. The other options are not used for creating infrastructure objects, but for configuring providers, accessing state data, or querying data sources.


Question 5

You just upgraded the version of a provider in an existing Terraform project. What do you need to do to install the new provider?



Answer : B

When upgrading a provider,you must run terraform init -upgrade to install the new version.

Thisdownloads the latest provider versionand updates the local dependency cache.

terraform refresh(A)only updates the state file but doesnotupgrade providers.

terraform apply -upgrade(C)isnot a valid command.

terraform version can be upgraded separately, but(D)does not install a new provider version.

Official Terraform Documentation Reference:

Upgrading Providers in Terraform


Question 6

Which of these statements about Terraform Cloud workspaces is false?



Answer : B

The statement that you must use the CLI to switch between workspaces is false. Terraform Cloud workspaces are different from Terraform CLI workspaces. Terraform Cloud workspaces are required and represent all of the collections of infrastructure in an organization. They are also a major component of role-based access in Terraform Cloud. You can grant individual users and user groupspermissions for one or more workspaces that dictate whether they can manage variables, perform runs, etc.You can create, view, and switch between Terraform Cloud workspaces using the Terraform Cloud UI, the Workspaces API, or the Terraform Enterprise Provider5. Terraform CLI workspaces are optional and allow you to create multiple distinct instances of a single configuration within one working directory. They are useful for creating disposable environments for testing or experimenting without affecting your main or production environment.You can create, view, and switch between Terraform CLI workspaces using the terraform workspace command6. The other statements about Terraform Cloud workspaces are true. They have role-based access controls that allow you to assign permissions to users and teams based on their roles and responsibilities.You can create and manage roles using the Teams API or the Terraform Enterprise Provider7. Plans and applies can be triggered via version control system integrations that allow you to link your Terraform Cloud workspaces to your VCS repositories.You can configure VCS settings, webhooks, and branch tracking to automate your Terraform Cloud workflow8. They can securely store cloud credentials as sensitive variables that are encrypted at rest and only decrypted when needed.You can manage variables using the Terraform Cloud UI, the Variables API, or the Terraform Enterprise Provider9.Reference= [Workspaces]5, [Terraform CLI Workspaces]6, [Teams and Organizations]7, [VCS Integration]8, [Variables]9


Question 7

You can define multiple backend blocks in your Terraform configuration to store your state in multiple locations.



Answer : B

Rationale for Correct Answer: A Terraform configuration supports only one backend at a time. The backend determines where state is stored and how locking works. Terraform does not support writing the same state to multiple backends simultaneously via multiple backend blocks.

Analysis of Incorrect Options (Distractors):

A (True): Incorrect---Terraform allows only a single backend configuration for a given working directory/root module.

Key Concept: Single-backend design: one state location per configuration/workspace.


Page:    1 / 14   
Total 301 questions