Terraform Associate State Management Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Thames
T
Thames
Community Contributor
Quizzes Created: 11982 | Total Attempts: 187,298
| Attempts: 16 | Questions: 20 | Updated: Aug 16, 2026
Please wait...
Question 1 / 21
🏆 Rank #-- ▾
0 %
0/100
Score 0/100

1. By default, where does Terraform store the state file locally?

Explanation

By default, Terraform stores its state file in the current working directory as `terraform.tfstate`. This file records the resources Terraform manages and their relationship to the configuration. If a remote backend is configured, Terraform stores the state remotely instead.

Submit
Please wait...
About This Quiz
Terraform Associate State Management Quiz - Quiz

This quiz evaluates your understanding of Terraform state management, a critical component of infrastructure-as-code workflows. You'll be tested on state file handling, remote state backends, state locking, and best practices for maintaining state consistency across teams. Mastering state management is essential for secure, collaborative Terraform deployments in production environments.

2.

What first name or nickname would you like us to use?

You may optionally provide this to label your report, leaderboard, or certificate.

2. What command retrieves the current value of a specific resource from state?

Explanation

`terraform state show resource.id` displays the attributes currently recorded for that resource in Terraform’s state. The other commands serve different purposes or are not valid Terraform commands for inspecting a resource’s state.

Submit

3. True or False: State refresh operations modify infrastructure directly.

Explanation

State refresh operations compare the real infrastructure with the stored state and update the state record to reflect what exists. They do not create, change, or delete infrastructure resources.

Submit

4. What does terraform state push do?

Explanation

`terraform state push` uploads a local Terraform state file to the configured remote backend, updating the state stored there. It is typically used to manually synchronize or repair remote state; Terraform may reject the upload if it detects that the local state could overwrite a newer version.

Submit

5. True or False: State files must be encrypted before storing in remote backends.

Explanation

State files do not universally have to be encrypted manually before upload: many remote backends provide encryption at rest and secure transport as part of their service. However, state can contain credentials or other sensitive values, so users should verify the backend’s protections and access controls and enable additional encryption when needed.

Submit

6. Which command imports existing infrastructure into Terraform state?

Explanation

`terraform import` brings an existing resource under Terraform management by adding it to the state file. This lets Terraform track the resource and manage it alongside resources defined in your configuration; you may still need to write or update the configuration to match the imported infrastructure.

Submit

7. What is the default location for state locking metadata in S3 backend?

Explanation

The S3 backend uses a DynamoDB table, configured in the backend settings, to store state-locking metadata. This table coordinates access and prevents multiple Terraform operations from modifying the same state simultaneously.

Submit

8. Which state backend stores state as a JSON file on the local filesystem?

Explanation

The local state backend stores application state in a JSON file on the machine’s local filesystem. This makes it straightforward to inspect and use for development or single-machine setups, but the state is tied to that filesystem rather than being stored in a distributed or remote backend.

Submit

9. What command lists all resources currently tracked in state?

Explanation

`terraform state list` displays the addresses of all resources currently tracked in the Terraform state file. Use `terraform state show ` to inspect the details of a specific resource.

Submit

10. When using S3 backend, which feature prevents concurrent state modifications?

Explanation

A DynamoDB table provides a lock on the Terraform state while an operation is in progress. This prevents multiple users or processes from modifying the state concurrently, helping avoid conflicts and corruption.

Submit

11. True or False: State files contain plaintext sensitive values by default.

Explanation

Terraform state files store resource attributes and configuration data so Terraform can track and manage infrastructure. Sensitive values, such as passwords or tokens, may therefore appear in the state file as plaintext by default. Marking a value as sensitive hides it in some command output, but does not automatically encrypt it in the state.

Submit

12. What is the purpose of terraform state rm?

Explanation

`terraform state rm` removes a resource’s record from Terraform’s state file without changing or destroying the actual infrastructure. Terraform will no longer manage that resource unless it is later imported back into the state.

Submit

13. Which command displays the current state in human-readable format?

Explanation

`terraform show` presents the current Terraform state in a readable format, including the resources and their recorded attributes. It can also display the contents of a saved plan. By contrast, `terraform state list` only lists resource addresses.

Submit

14. True or False: The terraform.tfstate file should be committed to version control.

Explanation

Terraform state files can contain sensitive values, resource identifiers, and details about your infrastructure. Committing them to version control risks exposing secrets and creates merge conflicts when multiple users or runs update the state. Store state in a secure remote backend with access controls, encryption, and locking instead; keep local state files out of the repository.

Submit

15. What does state locking prevent in Terraform?

Explanation

State locking prevents multiple Terraform operations from modifying the same state file at the same time. This avoids conflicting updates or state corruption during operations such as `apply`, helping keep Terraform’s record of infrastructure consistent.

Submit

16. Which backend is recommended for team environments requiring state locking?

Explanation

Terraform Cloud or Terraform Enterprise is recommended for team environments because it provides shared remote state and built-in state locking. Locking prevents multiple team members from changing the state simultaneously, reducing conflicts and the risk of inconsistent infrastructure. These services also support collaboration and centralized management of Terraform runs.

Submit

17. What is the primary purpose of Terraform state?

Explanation

Terraform state records the resources managed by Terraform and maps them to real-world infrastructure objects. This information lets Terraform track changes, determine what needs to be created or updated, and plan actions reliably.

Submit

18. True or False: terraform state mv can move resources between state files.

Explanation

True. `terraform state mv` can move resource addresses from one state file to another by specifying the source with `-state` and the destination with `-state-out`. This is useful when splitting or reorganizing Terraform configurations, but both resulting state files should be backed up and handled carefully to avoid losing or duplicating resource tracking.

Submit

19. Which state backend is managed by HashiCorp and includes built-in state locking?

Explanation

Terraform Cloud provides a managed remote backend for storing Terraform state. It also supports built-in state locking, preventing simultaneous operations from modifying the same state and helping keep infrastructure changes consistent.

Submit

20. True or False: terraform destroy removes resources but preserves state file.

Explanation

`terraform destroy` removes the managed infrastructure and updates the Terraform state to reflect that those resources no longer exist. It generally preserves the state file, which remains available for future Terraform operations.

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (20)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
By default, where does Terraform store the state file locally?
What command retrieves the current value of a specific resource from...
True or False: State refresh operations modify infrastructure...
What does terraform state push do?
True or False: State files must be encrypted before storing in remote...
Which command imports existing infrastructure into Terraform state?
What is the default location for state locking metadata in S3 backend?
Which state backend stores state as a JSON file on the local...
What command lists all resources currently tracked in state?
When using S3 backend, which feature prevents concurrent state...
True or False: State files contain plaintext sensitive values by...
What is the purpose of terraform state rm?
Which command displays the current state in human-readable format?
True or False: The terraform.tfstate file should be committed to...
What does state locking prevent in Terraform?
Which backend is recommended for team environments requiring state...
What is the primary purpose of Terraform state?
True or False: terraform state mv can move resources between state...
Which state backend is managed by HashiCorp and includes built-in...
True or False: terraform destroy removes resources but preserves state...
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!