You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The functionality for the Read function for data sources is not well documented on the HashiCorp Writing Custom Providers Guide, nor is it well described in the comments for the Resource type.
Naively following the guidance on the developer guide leads one to think that the correct behavior for a data source Read function would be to call d.SetId("") and return nil in the case that the referenced resource was not found. However, this is not the correct implementation, according to the discussion in the terraform-plugin-sdk forum
Attempted Solutions
N/A
Proposal
Document the correct behavior for the Read function in (1) website docs and (2) SDK comments for Read
Reference: #467
Reference: #601
Reference: #735
This also spends some cycles fixing the Go documentation for struct fields to be aligned with each field individually, so pkg.go.dev and the Go language server can appropriately show the matching documentation.
…pes (#912)
Reference: #467
Reference: #601
Reference: #705
Reference: #735
This also spends some cycles fixing the Go documentation for struct fields to be aligned with each field individually, so pkg.go.dev and the Go language server can appropriately show the matching documentation.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
SDK version
N/A - this is a documentation only issue
Use-cases
The functionality for the
Read
function for data sources is not well documented on the HashiCorp Writing Custom Providers Guide, nor is it well described in the comments for the Resource type.Naively following the guidance on the developer guide leads one to think that the correct behavior for a data source
Read
function would be to calld.SetId("")
and returnnil
in the case that the referenced resource was not found. However, this is not the correct implementation, according to the discussion in the terraform-plugin-sdk forumAttempted Solutions
N/A
Proposal
Document the correct behavior for the
Read
function in (1) website docs and (2) SDK comments forRead
References
https://discuss.hashicorp.com/t/data-source-behavior-resource-not-found/9542
The text was updated successfully, but these errors were encountered: