πŸ”

TA-003 β€” all questions

368 practice questions with answers and explanations.

Topic 1 Β· Question 1

As a developer, you want to ensure your plugins are up-to-date with the latest versions. Which Terraform command should you use?

  • Aterraform refresh -upgrade
  • Bterraform apply -upgrade
  • Cterraform providers -upgrade
  • Dterraform init -upgrade (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: terraform init -upgrade

Explanation

terraform init initializes a working directory, installs required providers and modules, and configures the backend.

Topic 1 Β· Question 2

Your security team scanned some Terraform workspaces and found secrets stored in plaintext in state files. How can you protect that data?

  • ADelete the state file every time you run Terraform.
  • BStore the state in an encrypted backend. (correct answer)
  • CAlways store your secrets in a secrets.tfvars file.
  • DEdit your state file to scrub out the sensitive data.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Store the state in an encrypted backend.

Explanation

A Terraform backend determines where state is stored and, for supported backends, how operations and locking are performed. This option keeps traffic private / properly secured as required.

Topic 1 Β· Question 3

How is the Terraform remote backend different than other state backends such as S3, Consul, etc.?

  • AIt can execute Terraform runs on dedicated infrastructure on premises or in Terraform Cloud (correct answer)
  • BIt doesn't show the output of a terraform apply locally
  • CIt is only available to paying customers
  • DAll of the above
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: It can execute Terraform runs on dedicated infrastructure on premises or in Terraform Cloud

Explanation

Terraform Cloud, now HCP Terraform, provides managed remote runs, state, collaboration, policy, and governance.

Topic 1 Β· Question 4

You add a new resource to an existing Terraform configuration, but do not update the version constraint in the configuration. The existing and new resources use the same provider. The working directory contains a .terraform.lock.hcl file. How will Terraform choose which version of the provider to use?

  • ATerraform will use the latest version of the provider for the new resource and the version recorded in the lock file to manage existing resources.
  • BTerraform will use the version recorded in your lock file. (correct answer)
  • CTerraform will check your state file to determine the provider version to use.
  • DTerraform will use the latest version of the provider available at the time you provision your new resource.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Terraform will use the version recorded in your lock file.

Topic 1 Β· Question 5

All standard backend types support state storage, locking, and remote operations like plan, apply, and destroy.

  • ATrue
  • BFalse (correct answer)
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: False

Topic 1 Β· Question 6

You run a local-exec provisioner in a null resource called null_resource.run_script and realize that you need to rerun the script. Which of the following commands would you use first?

  • Aterraform taint null_resource.run_script (correct answer)
  • Bterraform apply -target=null_resource.run_script
  • Cterraform validate null_resource.run_script
  • Dterraform plan -target=null_resource.run_script
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: terraform taint null_resource.run_script

Explanation

A null_resource provides lifecycle and provisioner behavior without directly managing external infrastructure.

Topic 1 Β· Question 7

Which provisioner invokes a process on the resource created by Terraform?

  • Aremote-exec (correct answer)
  • Bnull-exec
  • Clocal-exec
  • Dfile
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: remote-exec

Topic 1 Β· Question 8

terraform apply is failing with the following error. What next step should you take to determine the root cause of the problem? Error loading state: AccessDenied: Access Denied status code: 403, request id: 288766CE5CCA24A0, host id: web.example.com

  • ARun terraform login to reauthenticate with the provider.
  • BReview /var/log/terraform.log for error messages.
  • CReview syslog for Terraform error messages.
  • DSet TF_LOG=DEBUG. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Set TF_LOG=DEBUG.

Topic 1 Β· Question 9

What command does Terraform require the first time you run it within a configuration directory?

  • Aterraform import
  • Bterraform init (correct answer)
  • Cterraform plan
  • Dterraform workspace
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: terraform init

Explanation

terraform init initializes a working directory, installs required providers and modules, and configures the backend.

Topic 1 Β· Question 10

You have deployed a new webapp with a public IP address on a cloud provider. However, you did not create any outputs for your code. What is the best method to quickly find the IP address of the resource you deployed?

  • ARun terraform output ip_address to view the result
  • BIn a new folder, use the terraform_remote_state data source to load in the state file, then write an output for each resource that you find the state file
  • CRun terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address (correct answer)
  • DRun terraform destroy then terraform apply and look for the IP address in stdout
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address

Explanation

terraform state subcommands inspect and safely modify resource bindings recorded in state.

Topic 1 Β· Question 11

Which of these actions will prevent two Terraform runs from changing the same state file at the same time?

  • ADelete the state before running Terraform.
  • BRefresh the state after running Terraform.
  • CRun Terraform with parallelism set to 1.
  • DConfigure state locking for your state backend. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Configure state locking for your state backend.

Explanation

State locking prevents concurrent operations from writing conflicting state changes. A Terraform backend determines where state is stored and, for supported backends, how operations and locking are performed.

Topic 1 Β· Question 12

Terraform variables and outputs that set the "description" argument will store that description in the state file.

  • ATrue
  • BFalse (correct answer)
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: False

Topic 1 Β· Question 13

What is the provider for this fictitious resource?

Exhibit 1 for question 13
  • Avpc
  • Bmain
  • Caws (correct answer)
  • Dtest
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: aws

Topic 1 Β· Question 14 Β· Select all that apply

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? (Choose two.)

  • ARun terraform state rm *.
  • BRun terraform destroy.This will output all the resources that will be deleted before prompting for approval. (correct answer)
  • CRun terraform plan -destroy. (correct answer)
  • DRun terraform show -destroy.
Reveal answer & explanation
Correct answer: B, C

The correct answer is B, C. Option B: Run terraform destroy.This will output all the resources that will be deleted before prompting for approval. Option C: Run terraform plan -destroy.

Explanation

terraform plan compares configuration and state with real infrastructure and previews the proposed changes without applying them. terraform destroy removes infrastructure managed by the current Terraform configuration and state.

Topic 1 Β· Question 15

What is not processed when running a terraform refresh?

  • AState file
  • BConfiguration file (correct answer)
  • CCredentials
  • DCloud provider
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Configuration file

Topic 1 Β· Question 16

What information does the public Terraform Module Registry automatically expose about published modules?

  • ARequired input variables
  • BOptional inputs variables and default values
  • COutputs
  • DAll of the above (correct answer)
  • ENone of the above
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: All of the above

Topic 1 Β· Question 17

If a module uses a local values, you can expose that value with a terraform output.

  • ATrue (correct answer)
  • BFalse
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: True

Topic 1 Β· Question 18

You should store secret data in the same version control repository as your Terraform configuration.

  • ATrue
  • BFalse (correct answer)
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: False

Topic 1 Β· Question 19

Which of the following is not a valid string function in Terraform?

  • Asplit
  • Bjoin
  • Cslice (correct answer)
  • Dchomp
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: slice

Topic 1 Β· Question 20 Β· Select all that apply

You have provisioned some virtual machines (VMs) on Google Cloud Platform (GCP) using the gcloud command line tool. However, you are standardizing with Terraform and want to manage these VMs using Terraform instead. What are the two things you must do to achieve this? (Choose two.)

  • AProvision new VMs using Terraform with the same VM names
  • BUse the terraform import command for the existing VMs (correct answer)
  • CWrite Terraform configuration for the existing VMs (correct answer)
  • DRun the terraform import-gcp command
Reveal answer & explanation
Correct answer: B, C

The correct answer is B, C. Option B: Use the terraform import command for the existing VMs Option C: Write Terraform configuration for the existing VMs

Explanation

terraform import associates an existing remote object with a resource address in Terraform state.

Showing questions 1–20 of 368 Β· Page 1 of 19