Free Terraform Associate 004 Exam Braindumps
Terraform Associate 004 Questions 126–130 (page: 27)

Updated On: 10-Feb-2026

You add a new provider to your configuration and immediately run terraform apply in the CD using the local backend.
Why does the apply fail?

  1. The Terraform CD needs you to log into Terraform Cloud first
  2. Terraform requires you to manually run terraform plan first
  3. Terraform needs to install the necessary plugins first
  4. Terraform needs you to format your code according to best practices first

Answer(s): C

Explanation:

The reason why the apply fails after adding a new provider to the configuration and immediately running terraform apply in the CD using the local backend is because Terraform needs to install the necessary plugins first. Terraform providers are plugins that Terraform uses to interact with various cloud services and other APIs. Each provider has a source address that determines where to downloadit from.
When Terraform encounters a new provider in the configuration, it needs to run terraform init first to install the provider plugins in a local directory. Without the plugins, Terraform cannot communicate with the provider and perform the desired actions. Reference = [Provider Requirements], [Provider Installation]



Which two steps are required to provision new infrastructure in the Terraform workflow? Choose two correct answers.

  1. Plan
  2. Import
  3. Alidate
  4. Init
  5. apply

Answer(s): D,E

Explanation:

The two steps that are required to provision new infrastructure in the Terraform workflow are init and apply. The terraform init command initializes a working directory containing Terraform configuration files. It downloads and installs the provider plugins that are needed for the configuration, and prepares the backend for storing the state. The terraform apply command applies the changes required to reach the desired state of the configuration, as described by the resource definitions in the configuration files. It shows a plan of the proposed changes and asks for confirmation before making any changes to the infrastructure. Reference = [The Core Terraform Workflow], [Initialize a Terraform working directory with init], [Apply Terraform Configuration with apply]



What is the name of the default file where Terraform stores the state?

Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.

  1. Terraform.tfstate

Answer(s): A

Explanation:

The name of the default file where Terraform stores the state is terraform.tfstate. This file contains a JSON representation of the current state of the infrastructure managed by Terraform. Terraform uses this file to track the metadata and attributes of the resources, and to plan and apply changes. By default, Terraform stores the state file locally in the same directory as the configuration files, but it can also be configured to store the state remotely in a backend. Reference = [Terraform State], [State File Format]



Your risk management organization requires that new AWS S3 buckets must be private and encrypted at rest. How can Terraform Cloud automatically and proactively enforce this security control?

  1. Auditing cloud storage buckets with a vulnerability scanning tool
  2. By adding variables to each Terraform Cloud workspace to ensure these settings are always enabled
  3. With an S3 module with proper settings for buckets
  4. With a Sentinel policy, which runs before every apply

Answer(s): D

Explanation:

The best way to automatically and proactively enforce the security control that new AWS S3 buckets must be private and encrypted at rest is with a Sentinel policy, which runs before every apply. Sentinel is a policy as code framework that allows you to define and enforce logic-based policies for your infrastructure. Terraform Cloud supports Sentinel policies for all paid tiers, and can run them before any terraform plan or terraform apply operation. You can write a Sentinel policy that checks the configuration of the S3 buckets and ensures that they have the proper settings for privacy and encryption, and then assign the policy to your Terraform Cloud organization or workspace. This way, Terraform Cloud will prevent any changes that violate the policy from being applied. Reference = [Sentinel Policy Framework], [Manage Policies in Terraform Cloud], [Write and Test Sentinel Policies for Terraform]



Which of the following is not a key principle of infrastructure as code?

  1. Self-describing infrastructure
  2. Idempotence
  3. Versioned infrastructure
  4. Golden images

Answer(s): D

Explanation:

The key principle of infrastructure as code that is not listed among the options is golden images. Golden images are pre-configured, ready-to-use virtual machine images that contain a specific set of software and configuration. They are often used to create multiple identical instances of the same environment, such as for testing or production. However, golden images are not a principle of infrastructure as code, but rather a technique that can be used with or without infrastructure as code. The other options are all key principles of infrastructure as code, as explained below:

Self-describing infrastructure: This means that the infrastructure is defined in code that describes its desired state, rather than in scripts that describe the steps to create it. This makes the infrastructure easier to understand, maintain, and reproduce.

Idempotence: This means that applying the same infrastructure code multiple times will always result in the same state, regardless of the initial state. This makes the infrastructure consistent and predictable, and avoids errors or conflicts caused by repeated actions.

Versioned infrastructure: This means that the infrastructure code is stored in a version control system, such as Git, that tracks the changes and history of the code. This makes the infrastructure code reusable, auditable, and collaborative, and enables practices such as branching, merging, and rollback. Reference = [Introduction to Infrastructure as Code with Terraform], [Infrastructure as Code in a Private or Public Cloud]



Viewing page 27 of 53
Viewing questions 131 - 135 out of 147 questions


Post your Comments and Discuss HashiCorp Terraform Associate 004 exam prep with other Community members:

AI Tutor AI Tutor 👋 I’m here to help!