Which Terraform feature lets you read information from existing infrastructure without creating or modifying it?

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

Which Terraform feature lets you read information from existing infrastructure without creating or modifying it?

Explanation:
Reading information from existing infrastructure without creating or modifying it is handled in Terraform by data sources. A data source is a read-only query provided by a provider that fetches attributes of real resources or external objects, and makes those values available for use elsewhere in your configuration. This lets you, for example, look up an AMI or an existing instance ID and then reference those values when creating new resources, ensuring your config adapts to the current environment rather than hard-coding IDs. Backends determine where Terraform stores state, not how you read data from infrastructure. Modules are reusable groups of resources and configurations. Providers define which resources and data sources are available from a service, but the specific mechanism to read existing infrastructure is through data sources, which are explicitly read-only and designed for this purpose.

Reading information from existing infrastructure without creating or modifying it is handled in Terraform by data sources. A data source is a read-only query provided by a provider that fetches attributes of real resources or external objects, and makes those values available for use elsewhere in your configuration. This lets you, for example, look up an AMI or an existing instance ID and then reference those values when creating new resources, ensuring your config adapts to the current environment rather than hard-coding IDs.

Backends determine where Terraform stores state, not how you read data from infrastructure. Modules are reusable groups of resources and configurations. Providers define which resources and data sources are available from a service, but the specific mechanism to read existing infrastructure is through data sources, which are explicitly read-only and designed for this purpose.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy