I am very new to the provider SDK. I see lots of example code, but I haven’t found 1 central place that describes the minimum requirements for implementing the provider CRUD functions. I am specifically concerned with the proper way to handle what each CRUD function should do in the various scenarios of modifications to the system (i.e. what the provider is for) EXTERNAL to the terraform state. For example:
- What is the create function supposed to do if the resource already exists in the system? Should it throw an error or not? Should it set id to “” or not?
- What is the read function supposed to do if the resource no longer exists in the system? Should it throw an error or not? Should it set id to “” or not?
- Does the update function have to call HasChanges or can it just perform the update assuming the update function is only being called BECAUSE TF detected changes?
I guess I am looking for a boilerplate repo (using the latest sdk without using any deprecated function) with stubs for everything related to a data source and resource with comments on how to handle unexpected errors and when or when not to throw an error and when or when not to set id to a proper value OR “”.