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

Page: 1 / 14
Total 301 questions
Question 1

Which are examples of infrastructure as code? Choose two correct answers.



Answer : B

These are examples of infrastructure as code (IaC), which is a practice of managing and provisioning infrastructure through machine-readable definition files, rather than physical hardware configuration or interactive configuration tools.


Question 2

A provider configuration block is required in every Terraform configuration.

Example:



Answer : B

A provider configuration block isnotrequired in every Terraform configuration. A provider configuration block can be omitted if its contents would otherwise be empty. Terraform assumes an empty default configuration for any provider that is not explicitly configured. However, some providers may require some configuration arguments (such as endpoint URLs or cloud regions) before they can be used. A provider's documentation should list which configuration arguments it expects.For providers distributed on the Terraform Registry, versioned documentation is available on each provider's page, via the ''Documentation'' link in the provider's header1.Reference= [Provider Configuration]1


Question 3

If a module declares a variable with a default, that variable must also be defined within the module.



Answer : B

A module can declare a variable with a default value without requiring the caller to define it. This allows the module to provide a sensible default behavior that can be customized by the caller if needed.Reference= [Module Variables]


Question 4

Which of the following is true about terraform apply?(Pick 2 correct responses)



Answer : C, E

C (Correct)-- If changes require aresource replacement(e.g., changing an immutable attribute like instance type), Terraform willdestroy and recreate the resource.

E (Correct)-- Terraform only appliesthe configuration in the current directory or workspace.

Incorrect Answers:

A: (Incorrect)-- terraform apply can run without explicitly passing a plan.

B: (Incorrect)-- terraform applyautomatically refreshes statebefore making changes.

D: (Incorrect)-- Terraformcan target specific resourcesusing -target.Official Terraform Documentation Reference:terraform apply - HashiCorp Documentation


Question 5

You want to know from which paths Terraform is loading providers referenced in your Terraform configuration (* files). You need to enable additional logging messages to find this out. Which of the following would achieve this?



Answer : B

This will enable additional logging messages to find out from which paths Terraform is loading providers referenced in your Terraform configuration files, as it will set the log level toTRACE, which is the most verbose and detailed level.


Question 6

You used Terraform to create an ephemeral development environment in the cloud and are now ready to destroy all the infrastructure described by your Terraform configuration. To be safe, you would like to first see all the infrastructure that Terraform will delete.

Which command should you use to show all the resources that will be deleted? (Pick the 2 correct responses)



Answer : A, B

Runningterraform destroywill show all resources that will be deleted before prompting for approval. You can also runterraform plan -destroyto simulate the destruction without actually applying it, which is useful for reviewing the planned changes.


Terraform Destroy

Question 7

Any user can publish modules to the public Terraform Module Registry.



Answer : A

The Terraform Registry allows any user to publish and share modules. Published modules support versioning, automatically generate documentation, allow browsing version histories, show examples and READMEs, and more. Public modules are managed via Git and GitHub, and publishing a module takes only a few minutes.Once a module is published, releasing a new version of a module is as simple as pushing a properly formed Git tag1.

Reference= The information can be verified from the Terraform Registry documentation on Publishing Modules provided by HashiCorp Developer1.


Page:    1 / 14   
Total 301 questions