πŸ”

TA-003 β€” questions

Page 13 of 19 Β· 368 total questions.

Topic 1 Β· Question 246

When should you write Terraform configuration files for existing infrastructure that you want to start managing with Terraform?

  • ABefore you run terraform import (correct answer)
  • BYou can import infrastructure without corresponding Terraform code
  • CTerraform will generate the corresponding configuration files for you
  • DAfter you run terraform import
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Before you run terraform import

Explanation

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

Topic 1 Β· Question 247

Which command should you run to check if all code in a Terraform configuration that references multiple modules is properly formatted without making changes?

  • Aterraform fmt -write=false
  • Bterraform fmt -list -recursive
  • Cterraform fmt -check -recursive (correct answer)
  • Dterraform fmt -check
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: terraform fmt -check -recursive

Explanation

terraform fmt rewrites Terraform configuration into the canonical style and formatting.

Topic 1 Β· Question 248

What features stops multiple users from operating on the Terraform state at the same time?

  • AProvider constraints
  • BRemote backends
  • CState locking (correct answer)
  • DVersion control
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: State locking

Explanation

State locking prevents concurrent operations from writing conflicting state changes.

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

Which of these are secure options for storing secrets for connecting to a Terraform remote backend? (Choose two.)

  • AInside the backend block within the Terraform configuration
  • BDefined in Environment variables (correct answer)
  • CDefined in a connection configuration outside of Terraform (correct answer)
  • DA variable file
Reveal answer & explanation
Correct answer: B, C

The correct answer is B, C. Option B: Defined in Environment variables Option C: Defined in a connection configuration outside of Terraform This option keeps traffic private / properly secured as required.

Topic 1 Β· Question 251

You want to define a single input variable to capture configuration values for a server. The values must represent memory as a number, and the server name as a string. Which variable type could you use for this input?

  • AList
  • BObject (correct answer)
  • CMap
  • DTerraform does not support complex input variables of different types
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Object

Topic 1 Β· Question 252

What does Terraform not reference when running a terraform apply -refresh-only?

  • ACredentials
  • BState file
  • CTerraform resource definitions in configuration files (correct answer)
  • DCloud provider
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Terraform resource definitions in configuration files

Topic 1 Β· Question 253

Multiple team members are collaborating on infrastructure using Terraform and want to format their Terraform code following standard Terraform-style convention. How could they automatically ensure the code satisfies conventions?

  • ARun the terraform fmt command during the code linting phase of your CI/CD process (correct answer)
  • BManually apply two spaces indentation and align equal sign "=" characters in every Terraform file (*.tf)
  • CRun the terraform validate command prior to executing terraform plan or terraform apply
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Run the terraform fmt command during the code linting phase of your CI/CD process

Explanation

terraform fmt rewrites Terraform configuration into the canonical style and formatting.

Topic 1 Β· Question 254

When using a remote backend or Terraform Cloud integration, where does Terraform save resource state?

  • AOn the disk
  • BIn memory
  • CIn an environment variable
  • DIn the remote backend or Terraform Cloud (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: In the remote backend or Terraform Cloud

Explanation

A Terraform backend determines where state is stored and, for supported backends, how operations and locking are performed. Terraform Cloud, now HCP Terraform, provides managed remote runs, state, collaboration, policy, and governance.

Topic 1 Β· Question 256

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 257

You must use different Terraform commands depending on the cloud provider you use.

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

The correct answer is B. Option B: False

Topic 1 Β· Question 258

Define the purpose of state in Terraform.

  • AState stores variables and lets you quickly reuse existing code
  • BState lets you enforce resource configurations that relate to compliance policies
  • CState codifies the dependencies of related resources
  • DState maps real world resources to your configuration and keeps track of metadata (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: State maps real world resources to your configuration and keeps track of metadata

Topic 1 Β· Question 259

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

  • ARefresh the state after running Terraform
  • BDelete the state before running Terraform
  • CConfigure state locking for your state backend (correct answer)
  • DRun Terraform with parallelism set to 1
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: 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 260

While attempting to deploy resources into your cloud provider using Terraform, you begin to see some odd behavior and experience slow responses. In order to troubleshoot you decide to turn on Terraform debugging. Which environment variables must be configured to make Terraform’s logging more verbose?

  • ATF_LOG_PATH
  • BTF_VAR_log_level
  • CTF_LOG (correct answer)
  • DTF_VAR_log_path
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: TF_LOG

Topic 1 Β· Question 261

The Terraform binary version and provider versions must match each other in a single configuration.

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

The correct answer is B. Option B: False

Topic 1 Β· Question 262

The .terraform.lock.hcl file tracks module versions.

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

The correct answer is B. Option B: False

Topic 1 Β· Question 263

You can develop a custom provider to manage its resources using Terraform.

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

The correct answer is A. Option A: True

Topic 1 Β· Question 264

Which of these is not a benefit of remote state?

  • AKeeping unencrypted sensitive information off disk
  • BEasily share reusable code modules (correct answer)
  • CWorking in a team
  • DDelegate output to other teams
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Easily share reusable code modules

Explanation

A Terraform module packages related resources into a reusable configuration with defined inputs and outputs.

Topic 1 Β· Question 265

When using multiple configurations of the same Terraform provider, what meta-argument must be included in any non-default provider configurations?

  • Adepends_on
  • Balias (correct answer)
  • Cid
  • Dname
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: alias

Topic 1 Β· Question 266

A developer accidentally launched a VM (virtual machine) outside of the Terraform workflow and ended up with two servers with the same name. They don’t know which VM Terraform manages but do have a list of all active VM IDs. Which of the following methods could you use to discover which instance Terraform manages?

  • ARun terraform taint/code on all the VMs to recreate them
  • BUpdate the code to include outputs for the ID of all VMs, then run terraform plan to view the outputs
  • CRun terraform state list to find the names of all VMs, then run terraform state show for each of them to find which VM ID Terraform manages (correct answer)
  • DUse terraform refresh/code to find out which IDs are already part of state
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Run terraform state list to find the names of all VMs, then run terraform state show for each of them to find which VM ID Terraform manages

Explanation

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

Topic 1 Β· Question 267

Which of the following is not considered a safe way to inject sensitive values into a Terraform Cloud workspace?

  • AEdit the state file directly just before running terraform apply (correct answer)
  • BSet the variable value on the command line with the -var flag
  • CWrite the value to a file and specify the file with the -var-file flag
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Edit the state file directly just before running terraform apply

Explanation

terraform apply executes the dependency-aware changes required to make infrastructure match the configuration. Terraform state maps resource addresses to remote objects and stores metadata needed to calculate changes efficiently.

Showing questions 241–260 of 368 Β· Page 13 of 19