Free Terraform Associate 004 Exam Braindumps
Terraform Associate 004 Questions 106–110 (page: 23)

Updated On: 10-Feb-2026

When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.)

  1. When you change a Terraform-managed resource via the Azure Cloud Console, Terraform updates the state file to reflect the change during the next plan or apply
  2. Changing resources via the Azure Cloud Console records the change in the current state file
  3. When you change a resource via the Azure Cloud Console, Terraform records the changes in a new state file
  4. Changing resources via the Azure Cloud Console does not update current state file

Answer(s): A,D

Explanation:

Terraform state is a representation of the infrastructure that Terraform manages. Terraform uses state to track the current status of the resources it creates and to plan future changes. However, Terraform state is not aware of any changes made to the resources outside of Terraform, such as through the Azure Cloud Console, the Azure CLI, or the Azure API. Therefore, changing resources via the Azure Cloud Console does not update the current state file, and it may cause inconsistencies or conflicts with Terraform's desired configuration. To avoid this, it is recommended to manage resources exclusively through Terraform or to use the terraform import command to bring existing resources under Terraform's control.

When you change a Terraform-managed resource via the Azure Cloud Console, Terraform does not immediately update the state file to reflect the change. However, the next time you run terraform plan or terraform apply, Terraform will compare the state file with the actual state of the resources in Azure and detect any drifts or differences. Terraform will then update the state file to match the current state of the resources and show you the proposed changes in the execution plan. Depending on the configuration and the change, Terraform may try to undo the change, modify the resource further, or recreate the resource entirely. To avoid unexpected or destructive changes, it is recommended to review the execution plan carefully before applying it or to use the terraform refresh command to update the state file without applying any changes.

Reference = Purpose of Terraform State, Terraform State, Managing State, Importing Infrastructure, [Command: plan], [Command: apply], [Command: refresh]



Which of the following should you put into the required_providers block?

  1. version >= 3.1
  2. version = ">= 3.1"
  3. version ~> 3.1

Answer(s): B

Explanation:

The required_providers block is used to specify the provider versions that the configuration can work with. The version argument accepts a version constraint string, which must be enclosed in double quotes. The version constraint string can use operators such as >=, ~>, =, etc. to specify the minimum, maximum, or exact version of the provider. For example, version = ">= 3.1" means that theconfiguration can work with any provider version that is 3.1 or higher. Reference = [Provider Requirements] and [Version Constraints]



Which of the following methods, used to provision resources into a public cloud, demonstrates the concept of infrastructure as code?

  1. curl commands manually run from a terminal
  2. A sequence of REST requests you pass to a public cloud API endpoint Most Voted
  3. A script that contains a series of public cloud CLI commands
  4. A series of commands you enter into a public cloud console

Answer(s): C

Explanation:

The concept of infrastructure as code (IaC) is to define and manage infrastructure using code, rather than manual processes or GUI tools. A script that contains a series of public cloud CLI commands is an example of IaC, because it uses code to provision resources into a public cloud. The other options are not examples of IaC, because they involve manual or interactive actions, such as running curl commands, sending REST requests, or entering commands into a console. Reference = [Introduction to Infrastructure as Code with Terraform] and [Infrastructure as Code]



Which are forbidden actions when the terraform state file is locked? Choose three correct answers.

  1. Terraform state list
  2. Terraform destroy
  3. Terraform validate
  4. Terraform validate
  5. Terraform for
  6. Terraform apply

Answer(s): B,C,F

Explanation:

The terraform state file is locked when a Terraform operation that could write state is in progress. This prevents concurrent state operations that could corrupt the state. The forbidden actions when the state file is locked are those that could write state, such as terraform apply, terraform destroy, terraform refresh, terraform taint, terraform untaint, terraform import, and terraform state *. The terraform validate command is also forbidden, because it requires an initialized working directory with the state file. The allowed actions when the state file is locked are those that only read state, such as terraform plan, terraform show, terraform output, and terraform console. Reference = [State Locking] and [Command: validate]



Which of these ate secure options for storing secrets for connecting to a Terraform remote backend? Choose two correct answers.

  1. A variable file
  2. Defined in Environment variables
  3. Inside the backend block within the Terraform configuration
  4. Defined in a connection configuration outside of Terraform

Answer(s): B,D

Explanation:

Environment variables and connection configurations outside of Terraform are secure options for storing secrets for connecting to a Terraform remote backend. Environment variables can be used to set values for input variables that contain secrets, such as backend access keys or tokens. Terraform will read environment variables that start with TF_VAR_ and match the name of an input variable. For example, if you have an input variable called backend_token, you can set its value with the environment variable TF_VAR_backend_token1. Connection configurations outside of Terraform are files or scripts that provide credentials or other information for Terraform to connect to a remote backend. For example, you can use a credentials file for the S3 backend2, or a shell script for the HTTP backend3. These files or scripts are not part of the Terraform configuration and can be stored securely in a separate location. The other options are not secure for storing secrets. A variable file is a file that contains values for input variables. Variable files are usually stored in the same directory as the Terraform configuration or in a version control system. This exposes the secrets to anyone who can access the files or the repository. You should not store secrets in variable files1. Inside the backend block within the Terraform configuration is where you specify the type and settings of the remote backend. The backend block is part of the Terraform configuration and is usually stored in a version control system. This exposes the secrets to anyone who can access the configuration or the repository. You should not store secrets in the backend block4. Reference = [Terraform Input Variables]1, [Backend Type: s3]2, [Backend Type: http]3, [Backend Configuration]4



Viewing page 23 of 53
Viewing questions 111 - 115 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!