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

Document Relationships Between Terraform Commands, Protocol RPCs, and Framework Functionality #587

Closed
bflad opened this issue Dec 15, 2022 · 1 comment · Fixed by #618
Closed
Labels
documentation Improvements or additions to documentation

Comments

@bflad
Copy link
Contributor

bflad commented Dec 15, 2022

Module version

v1.0.0

Use-cases

The current website documentation mainly serves as a reference for framework functionality, but only off-handedly mentions the functionality's relationship with practitioner usage. For example, it may be confusing to provider developers that provider configuration does not happen before configuration validation due to how Terraform is designed.

A quick reference for what we mean can be found with the below ordered tables --

terraform validate

Protocol RPCs Framework Functionality
GetProviderSchema datasource.DataSource, provider.Provider, and resource.Resource interface Schema method
ValidateDataSourceConfig / ValidateProviderConfig / ValidateResourceConfig datasource.DataSource, provider.Provider, and resource.Resource interface Schema method validators, ConfigValidators method, and ValidateConfig method

terraform plan (with default -refresh=true)

Protocol RPCs Framework Functionality
GetProviderSchema datasource.DataSource, provider.Provider, and resource.Resource interface Schema method
ValidateDataSourceConfig / ValidateProviderConfig / ValidateResourceConfig datasource.DataSource, provider.Provider, and resource.Resource interface Schema method validators, ConfigValidators method, and ValidateConfig method
ConfigureProvider provider.Provider interface Configure method
ReadDataSource / ReadResource datasource.DataSource and resource.Resource interface Read method
PlanResourceChange resource.Resource interface Schema method plan modifiers and ModifyPlan method

terraform apply (with default -refresh=true and without using saved plan file)

Protocol RPCs Framework Functionality
GetProviderSchema datasource.DataSource, provider.Provider, and resource.Resource interface Schema method
ValidateDataSourceConfig / ValidateProviderConfig / ValidateResourceConfig datasource.DataSource, provider.Provider, and resource.Resource interface Schema method validators, ConfigValidators method, and ValidateConfig method
ConfigureProvider provider.Provider interface Configure method
ReadDataSource / ReadResource datasource.DataSource and resource.Resource interface Read method
PlanResourceChange resource.Resource interface Schema method plan modifiers and ModifyPlan method
ApplyResourceChange resource.Resource interface Create, Update, or Delete method

Attempted Solutions

Discussing these relationships via GitHub Issues and HashiCorp Discuss.

Proposal

Split https://developer.hashicorp.com/terraform/plugin/how-terraform-works#terraform-plugin-protocol into its own page. Document the RPCs there and update the Protocol Buffers definition comments to match. Document roughly when Terraform calls each RPC there.

In the framework documentation for specific functionality, mention and link to associated RPC in the top-level protocol page section for the RPC.

@bflad bflad added the documentation Improvements or additions to documentation label Dec 15, 2022
bendbennett added a commit that referenced this issue Jan 11, 2023
…form commands, RPCs and framework functionality (#587)
bendbennett added a commit that referenced this issue Jan 30, 2023
bendbennett added a commit that referenced this issue Jan 30, 2023
bendbennett added a commit that referenced this issue Jan 30, 2023
…o be removed from the provider schema and transferred to ConfigureFunc or ConfigureContextFunc when using muxing with an SDK provider (#587)
bendbennett added a commit that referenced this issue Jan 30, 2023
bendbennett added a commit that referenced this issue Jan 30, 2023
bendbennett added a commit that referenced this issue Jan 31, 2023
bendbennett added a commit that referenced this issue Jan 31, 2023
… Framework Functionality (#618)

* Adding RPCs top-level page to describe the relationship between Terraform commands, RPCs and framework functionality (#587)

* Updating formatting and links (#587)

* Moving RPCs and Framework Functionality into a new internals section and linking RPCs from individual pages (#587)

* Fixing links (#587)

* Adding README to document how the images used within the documentation are generated (#587)

* Adding documentation to highlight that Default and DefaultFunc need to be removed from the provider schema and transferred to ConfigureFunc or ConfigureContextFunc when using muxing with an SDK provider (#587)

* Fixing links (#587)

* Updating timeouts examples (#587)

* Apply suggestions from code review

Co-authored-by: Brian Flad <bflad417@gmail.com>

* Add note about when Configure is called on data sources and resources (#587)

* Replacing tabs with spaces (#587)

* Adding HTML comments to link to README for information on creation of .png files (#587)

---------

Co-authored-by: Brian Flad <bflad417@gmail.com>
@github-actions
Copy link

github-actions bot commented Mar 3, 2023

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 Mar 3, 2023
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
1 participant