July 2021
Intermediate to advanced
408 pages
9h 51m
English
This appendix is a supplement to chapter 11. It explains how to implement a data source for the Petstore provider, which complements the pet resource. The data source described here allows users to query the ID of pet resources by name. An example of using the data source is as follows:
data "petstore_pet_ids" "all" {
names = ["*"]
}
data "petstore_pet_ids" "my_pets" {
["snowball", "princess"]
}
The data source has a single required argument called names, which is a list of pet names to search for (an asterisk selects all pets). The data source exports an ids attribute, which is a list of pet IDs.
As we did with the pet resource, we need to register the data source with ...
Read now
Unlock full access