Free Terraform Associate 004 Exam Braindumps
Terraform Associate 004 Questions 101–105 (page: 22)

Updated On: 10-Feb-2026

Which of the following does terraform apply change after you approve the execution plan? (Choose two.)

  1. Cloud infrastructure
  2. The .terraform directory
  3. The execution plan
  4. State file
  5. Terraform code

Answer(s): A,D

Explanation:

The terraform apply command changes both the cloud infrastructure and the state file after you approve the execution plan. The command creates, updates, or destroys the infrastructure resources to match theconfiguration. It also updates the state file to reflect the new state of the infrastructure. The .terraform directory, the execution plan, and the Terraform code are not changed by the terraform apply command. Reference = Command: apply and Purpose of Terraform State



You are working on some new application features and you want to spin up a copy of your production deployment to perform some quick tests. In order to avoid having to configure a new state backend, what open source Terraform feature would allow you create multiple states but still be associated with your current code?

  1. Terraform data sources
  2. Terraform local values
  3. Terraform modules
  4. Terraform workspaces
  5. None of the above

Answer(s): D

Explanation:

Terraform workspaces allow you to create multiple states but still be associated with your current code. Workspaces are like "environments" (e.g. staging, production) for the same configuration. You can use workspaces to spin up a copy of your production deployment for testing purposes without having to configure a new state backend. Terraform data sources, local values, and modules are not features that allow you to create multiple states. Reference = Workspaces and How to Use Terraform Workspaces



Which of the following commands would you use to access all of the attributes and details of a resource managed by Terraform?

  1. terraform state list `provider_type.name'
  2. terraform state show `provider_type.name'
  3. terraform get `provider_type.name'
  4. terraform state list

Answer(s): B

Explanation:

The terraform state show command allows you to access all of the attributes and details of a resource managed by Terraform. You can use the resource address (e.g. provider_type.name) as an argument to show the information about a specific resource. The terraform state list command only shows the list of resources in the state, not their attributes. The terraform get command downloads and installs modules needed for the configuration. It does not show any information about resources. Reference = [Command: state show] and [Command: state list]



If you manually destroy infrastructure, what is the best practice reflecting this change in Terraform?

  1. Run terraform refresh
  2. It will happen automatically
  3. Manually update the state fire
  4. Run terraform import

Answer(s): B

Explanation:

If you manually destroy infrastructure, Terraform will automatically detect the change and update the state file during the next plan or apply. Terraform compares the current state of the infrastructure with the desired state in the configuration and generates a plan to reconcile the differences. If a resource is missing from the infrastructure but still exists in the state file, Terraform will attempt to recreate it. If a resource is present in the infrastructure but not in the state file, Terraform will ignore it unless you use the terraform import command to bring it under Terraform's management. Reference = [Terraform State]



Which option cannot be used to keep secrets out of Terraform configuration files?

  1. A Terraform provider
  2. Environment variables
  3. A -var flag
  4. secure string

Answer(s): D

Explanation:

A secure string is not a valid option to keep secrets out of Terraform configuration files. A secure string is a feature of AWS Systems Manager Parameter Store that allows you to store sensitive data encrypted with a KMS key. However, Terraform does not support secure strings natively and requires a custom data source to retrieve them. The other options are valid ways to keep secrets out of Terraform configuration files. A Terraform provider can expose secrets as data sources that can be referenced in the configuration. Environment variables can be used to set values for input variables that contain secrets. A -var flag can be used to pass values for input variables that contain secrets from the command line or a file. Reference = [AWS Systems Manager Parameter Store], [Terraform

AWS Provider Issue #55], [Terraform Providers], [Terraform Input Variables]



Viewing page 22 of 53
Viewing questions 106 - 110 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!