Terraform Associate Resource and Data Sources 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: 11 | Questions: 20 | Updated: Aug 16, 2026
Please wait...
Question 1 / 21
🏆 Rank #-- ▾
0 %
0/100
Score 0/100

1. What is the aws_availability_zones data source used for?

Explanation

The `aws_availability_zones` data source retrieves information about the availability zones available in your AWS region. This lets you reference existing zones in your configuration without creating or deleting them.

Submit
Please wait...
About This Quiz
Terraform Associate Resource and Data Sources Quiz - Quiz

This quiz evaluates your understanding of Terraform resources and data sources, core components of infrastructure-as-code workflows. You'll test your knowledge of resource creation, data source queries, state management, and how these elements interact in Terraform configurations. Essential for anyone preparing for the Terraform Associate certification or working with cloud infrastructure... see moreautomation. see less

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. In Terraform, what is the relationship between resources, data sources, and the state file?

Explanation

Terraform records both managed resources and data source results in the state file. Resources represent infrastructure Terraform manages and can change, while data sources perform read-only lookups of existing information for use in configuration.

Submit

3. Which data source would you use to look up an existing security group by name?

Explanation

Use the `aws_security_group` data source to look up an existing security group by its name, ID, or supported filters. It retrieves information about the group for use elsewhere in a configuration. `aws_security_group_rule` concerns individual rules, while the other listed names are not the appropriate data source for this lookup.

Submit

4. What is a resource dependency in Terraform?

Explanation

A resource dependency defines the order Terraform uses when creating or updating resources. If one resource relies on another, Terraform ensures the required resource is created first, helping prevent errors and ensuring configurations are applied correctly.

Submit

5. In Terraform, can you use interpolation syntax to reference resource and data source attributes?

Explanation

Terraform expressions can reference attributes from both resources and data sources. In older Terraform syntax, references commonly appeared inside interpolation markers such as `${aws_instance.example.id}`. In modern Terraform, a direct reference like `aws_instance.example.id` is used in expressions, while `${...}` remains useful inside strings and templates.

Submit

6. The aws_vpc data source is typically used to retrieve which information?

Explanation

In Terraform, the `aws_vpc` data source looks up a VPC that already exists in AWS, using its ID or filters. It provides attributes such as the VPC ID, CIDR block, state, and tags for use by other resources. It reads information only; creating, deleting, or changing VPCs requires managed resources.

Submit

7. How can you use a data source output in a resource argument?

Explanation

In Terraform, reference a data source’s output with the `data` namespace, followed by its provider-defined data source type, the local name assigned in its configuration, and the attribute you need. This lets a resource argument use the fetched value, for example: `data.provider_type.name.attribute`.

Submit

8. What is required to use a specific data source in Terraform?

Explanation

Terraform data sources are accessed through providers, which supply the connection and functionality needed to query a particular service or platform. Configure the appropriate provider in your Terraform configuration before using its data source. A matching Terraform resource, per-query manual approval, or a separate registry subscription is not generally required.

Submit

9. Which block defines the actual infrastructure that Terraform will create and manage?

Explanation

A `resource` block specifies the infrastructure Terraform should create and manage, such as a virtual machine, network, or storage bucket. Terraform uses its configuration to provision the resource and track its state. `data` blocks read existing information, while `output` and `locals` blocks expose or organize values.

Submit

10. When you destroy Terraform-managed resources, what happens to data source queries?

Explanation

Terraform data sources are read-only references used to look up information about existing resources. Destroying managed resources does not destroy data sources themselves; Terraform simply stops querying them when they are no longer needed.

Submit

11. What is the primary difference between a Terraform resource and a data source?

Explanation

Terraform resources manage infrastructure by creating, updating, or deleting it. Data sources query information about existing infrastructure or external systems without managing or changing those objects.

Submit

12. In Terraform state, are data source values stored?

Explanation

Terraform records the attributes returned by a data source in state after reading it. This lets Terraform use those values to evaluate references and manage dependent resources. The values can be refreshed during later operations when Terraform reads the data source again.

Submit

13. What happens when you apply a Terraform configuration with only data sources and no resources?

Explanation

Terraform data sources read information about existing infrastructure or external systems. When a configuration contains only data sources, Terraform queries them during planning or applying, but creates, changes, or destroys no infrastructure because there are no managed resources.

Submit

14. Which of the following is a valid use case for data sources?

Explanation

Data sources let Terraform read information from external systems or existing infrastructure without creating or modifying it. They can look up the current Ubuntu AMI ID for a selected region and make it available to other configuration. Creating a VPC and defining security group rules are resource-management tasks, while provider credentials belong in provider configuration.

Submit

15. In Terraform, what is a 'computed' attribute in a resource?

Explanation

A computed attribute is determined by the provider rather than supplied as an input when configuring a resource. Its value becomes available after Terraform creates or refreshes the resource, such as an automatically assigned ID or IP address.

Submit

16. What is the purpose of the aws_ami data source in Terraform?

Explanation

The `aws_ami` data source looks up existing Amazon Machine Images (AMIs) using specified filters, such as name or owner, and makes their IDs and other properties available to Terraform. It reads AMI information without creating or deleting images.

Submit

17. How do you reference a data source in Terraform configuration?

Explanation

Terraform data sources are referenced using the `data..` format. The type identifies the provider’s data source, and the name is the local label assigned to it in the configuration. For example, `data.aws_ami.example.id` accesses the `id` attribute of a data source labeled `example`.

Submit

18. Which syntax is correct for referencing a resource in Terraform?

Explanation

Terraform references a managed resource using its resource type followed by its local name, separated by a dot: `aws_instance.example`. The other options reverse the order, append `.resource`, or use an unsupported `@` prefix. This reference can be used in expressions to access the resource or its attributes, such as `aws_instance.example.id`.

Submit

19. What does the data source block allow you to do in Terraform?

Explanation

A Terraform data source reads information about existing infrastructure or external systems without managing or creating those resources. You can then reference the retrieved data elsewhere in your configuration, such as using details about an existing network to configure a new resource.

Submit

20. In Terraform, which block type is used to define a managed resource?

Explanation

A `resource` block declares infrastructure that Terraform manages, such as a virtual machine, network, or database. It specifies the resource type, a local name, and configuration arguments. Terraform uses this declaration to create, update, or destroy the resource as needed to match the desired configuration.

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (20)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
What is the aws_availability_zones data source used for?
In Terraform, what is the relationship between resources, data...
Which data source would you use to look up an existing security group...
What is a resource dependency in Terraform?
In Terraform, can you use interpolation syntax to reference resource...
The aws_vpc data source is typically used to retrieve which...
How can you use a data source output in a resource argument?
What is required to use a specific data source in Terraform?
Which block defines the actual infrastructure that Terraform will...
When you destroy Terraform-managed resources, what happens to data...
What is the primary difference between a Terraform resource and a data...
In Terraform state, are data source values stored?
What happens when you apply a Terraform configuration with only data...
Which of the following is a valid use case for data sources?
In Terraform, what is a 'computed' attribute in a resource?
What is the purpose of the aws_ami data source in Terraform?
How do you reference a data source in Terraform configuration?
Which syntax is correct for referencing a resource in Terraform?
What does the data source block allow you to do in Terraform?
In Terraform, which block type is used to define a managed resource?
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!