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

Implement Protocol Version 5.3 and 6.3 (ServerCapabilities and PlanResourceChange on Destroy) #204

Closed
bflad opened this issue Jul 6, 2022 · 3 comments · Fixed by #205
Closed
Labels
enhancement New feature or request
Milestone

Comments

@bflad
Copy link
Member

bflad commented Jul 6, 2022

terraform-plugin-go version

v0.10.0

Use cases

Prior to Terraform 1.3, Terraform plans all destroy operations without consulting providers. New protocol functionality is now available for servers (providers) to announce support for capabilities, with destroy planning being the first capability. Providers can use this opportunity to return warnings or errors diagnostics when resource destruction is proposed, based on any business logic. This is opt-in to protect any existing implementations which may not be ready to receive an empty ProposedNewState during the PlanResourceChange RPC.

Attempted solutions

Without support in this Go module, one would have to directly interface with gRPC or fork this Go module with support.

Proposal

  • Copy protocol buffer definitions for protocol versions 5.3 and 6.3
  • Regenerate protocol buffer Go files
  • Implement tfprotov5 and tfprotov6 types for ServerCapabilities, add to GetProviderSchemaResponse, and wire conversions to/from protocol buffer Go types
  • Ensure tfprotov5/tf5server and tfprotov6/tf6server are all squared away with the new functionality

References

@bflad bflad added the enhancement New feature or request label Jul 6, 2022
@bflad bflad added this to the v0.11.0 milestone Jul 6, 2022
@bflad
Copy link
Member Author

bflad commented Jul 6, 2022

Terraform CLI v1.3.0-alpha20220706 is the first release with this support.

@magodo
Copy link

magodo commented Jul 19, 2022

@bflad Thank you for introducing this new capability! I'm trying to understand when it should should be used.

Providers can use this opportunity to return warnings or errors diagnostics when resource destruction is proposed, based on any business logic.

Does this mean now the provider can left shift the error/warning at plan time, rather than fail at delete/apply time?

@bflad
Copy link
Member Author

bflad commented Jul 28, 2022

@magodo that is correct 👍 To prevent backwards compatibility issues for PlanResourceChange handling code, the new capability has to be explicitly enabled by any providers written directly in terraform-plugin-go or the SDKs (terraform-plugin-sdk and terraform-plugin-framework) themselves for providers using those. terraform-plugin-framework 0.10.0 released with that capability enabled. terrafrom-plugin-sdk would require some thought before enabling it, since we cannot break compatibility with existing CustomizeDiff logic that might not be ready for a wholly null plan value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants