nerdexam
HashiCorp

TA-002-P · Question #300

Complete the following sentence: The terraform state command can be used to ____

The correct answer is A. modify state. The terraform state command is used to modify state, with subcommands like mv, rm, and replace-provider enabling direct state manipulation.

Implement and maintain state

Question

Complete the following sentence:

The terraform state command can be used to ____

Options

  • Amodify state
  • Bview state
  • Crefresh state
  • DThere is no such command

How the community answered

(29 responses)
  • A
    93% (27)
  • B
    3% (1)
  • D
    3% (1)

Why each option

The terraform state command is used to modify state, with subcommands like mv, rm, and replace-provider enabling direct state manipulation.

Amodify stateCorrect

The terraform state command provides subcommands that directly modify the Terraform state file - terraform state mv renames or moves resources within or between states, terraform state rm removes resources from state tracking, and terraform state replace-provider updates provider references. Modification is the primary and defining capability of the command.

Bview state

While terraform state list and terraform state show can display state content, 'view state' understates the command's primary purpose, which is direct state modification.

Crefresh state

Refreshing state is performed with terraform refresh or terraform apply -refresh-only, not with the terraform state command.

DThere is no such command

terraform state is a valid, well-documented, and widely used Terraform CLI command with multiple subcommands.

Concept tested: Terraform state command subcommands for state modification

Source: https://developer.hashicorp.com/terraform/cli/commands/state

Topics

#terraform state#state management#CLI commands#state modification

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice