Which statement about Terraform state is true?

Prepare for the HashiCorp Terraform Associate Exam. Utilize flashcards and multiple-choice questions with detailed hints and explanations. Boost your confidence and be ready for success!

Multiple Choice

Which statement about Terraform state is true?

Explanation:
Terraform state is the source of truth for what Terraform manages. It records the real resources that exist and how they map to the resources defined in your configuration, including the IDs Terraform uses to read, update, or delete those resources. This state lives outside your configuration files—usually in a local file or in a remote backend—and should be protected because it can contain sensitive information and is the mechanism Terraform uses to apply changes. Providers rely on this state to know which resources exist and what IDs to use when making API calls, so without a correct state file Terraform wouldn’t know what to create or modify. That’s why the statement that the state file tracks real resources and mappings, and that it’s not stored in the code and should be protected, is the true description. The other options are inaccurate: state isn’t stored in the code repository by default, and while the state file can be in JSON, it isn’t guaranteed to be exposed as plaintext in all setups, and state is indeed used by providers during resource creation and updates.

Terraform state is the source of truth for what Terraform manages. It records the real resources that exist and how they map to the resources defined in your configuration, including the IDs Terraform uses to read, update, or delete those resources. This state lives outside your configuration files—usually in a local file or in a remote backend—and should be protected because it can contain sensitive information and is the mechanism Terraform uses to apply changes. Providers rely on this state to know which resources exist and what IDs to use when making API calls, so without a correct state file Terraform wouldn’t know what to create or modify. That’s why the statement that the state file tracks real resources and mappings, and that it’s not stored in the code and should be protected, is the true description. The other options are inaccurate: state isn’t stored in the code repository by default, and while the state file can be in JSON, it isn’t guaranteed to be exposed as plaintext in all setups, and state is indeed used by providers during resource creation and updates.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy