Is there a reason why you want to use
GetChange for a data source?
Terraform data sources implements the “CR” (create and read) in CRUD. As a result, if you’re creating or modifying a data source, you should already have access to the computed value.
The three core steps in implementing a data source read is:
- Retrieve data from the API (Lines 73-83)
- Map response to a
struct that the TF SDK can understand (Lines 84-88)
- Set the data source values (Lines 90-92)
If you wanted to apply conditional logic based on the data you received from the API, you would do it between steps 2 and 3. You would just access the data directly from the struct you created (i.e.
The Setup and Implement Read tutorial walks you through the process of setting up a sample Terraform provider and creating a data source.
Hope this answer your question and have a great day!