Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Describe correct behavior for data source Read functions #467

Closed
nmiodice opened this issue Jun 3, 2020 · 1 comment · Fixed by #912
Closed

[docs] Describe correct behavior for data source Read functions #467

nmiodice opened this issue Jun 3, 2020 · 1 comment · Fixed by #912
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@nmiodice
Copy link

nmiodice commented Jun 3, 2020

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 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

References

https://discuss.hashicorp.com/t/data-source-behavior-resource-not-found/9542

@nmiodice nmiodice added the enhancement New feature or request label Jun 3, 2020
@bflad bflad added documentation Improvements or additions to documentation and removed enhancement New feature or request labels Mar 16, 2022
@bflad bflad modified the milestones: v2.12.0, v2.13.0 Mar 16, 2022
@bflad bflad self-assigned this Mar 22, 2022
bflad added a commit that referenced this issue Mar 23, 2022
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.
bflad added a commit that referenced this issue Mar 23, 2022
…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.
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
2 participants