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

Updates for Protocol Version 5.4 #1234

Closed
bflad opened this issue Aug 25, 2023 · 1 comment · Fixed by #1235
Closed

Updates for Protocol Version 5.4 #1234

bflad opened this issue Aug 25, 2023 · 1 comment · Fixed by #1235
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@bflad
Copy link
Member

bflad commented Aug 25, 2023

SDK version

v2.28.0

Use-cases

Terraform 1.6 is introducing new functionality which can greatly reduce memory utilization when there are multiple instances of same provider type, by only calling the GetProviderSchema RPC against one provider instance. This can be accomplished by the provider signaling to core that the GetProviderSchema RPC is not required before other RPCs. To support this enhancement with terraform-plugin-mux use cases, a lighter-weight GetMetadata RPC is being introduced which only returns server capabilities and resource type names.

Proposal

Update terraform-plugin-go dependency with protocol version 5.4 changes. Enable GetProviderSchemaOptional server capability, as none of the functionality of this SDK is reliant on RPC ordering, and implement the GetMetadata RPC.

It is anticipated that providers needing the memory usage improvements will upgrade these Go module dependencies at once:

  • terraform-plugin-go (targeting v0.19.0)
  • terraform-plugin-framework (targeting v1.4.0)
  • terraform-plugin-sdk (targeting v2.29.0)
  • terraform-plugin-mux (targeting v0.12.0)

References

@bflad bflad added the enhancement New feature or request label Aug 25, 2023
@bflad bflad added this to the v2.29.0 milestone Aug 25, 2023
@bflad bflad self-assigned this Aug 25, 2023
bflad added a commit that referenced this issue Aug 25, 2023
bflad added a commit that referenced this issue Sep 6, 2023
bflad added a commit that referenced this issue Sep 6, 2023
techknowlogick pushed a commit to go-gitea/terraform-provider-gitea that referenced this issue Sep 8, 2023
… to v2.29.0 (#17)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/hashicorp/terraform-plugin-sdk/v2](https://github.com/hashicorp/terraform-plugin-sdk) | require | minor | `v2.27.0` -> `v2.29.0` |

---

### Release Notes

<details>
<summary>hashicorp/terraform-plugin-sdk (github.com/hashicorp/terraform-plugin-sdk/v2)</summary>

### [`v2.29.0`](https://github.com/hashicorp/terraform-plugin-sdk/releases/tag/v2.29.0)

[Compare Source](hashicorp/terraform-plugin-sdk@v2.28.0...v2.29.0)

NOTES:

-   all: This Go module has been updated to Go 1.20 per the [Go support policy](https://go.dev/doc/devel/release#policy). It is recommended to review the [Go 1.20 release notes](https://go.dev/doc/go1.20) before upgrading. Any consumers building on earlier Go versions may experience errors. ([#&#8203;1245](hashicorp/terraform-plugin-sdk#1245))

FEATURES:

-   helper/schema: Upgrade to protocol version 5.4, which can significantly reduce memory usage with Terraform 1.6 and later when a configuration includes multiple instances of the same provider ([#&#8203;1234](hashicorp/terraform-plugin-sdk#1234))

ENHANCEMENTS:

-   helper/validation: Added `AllDiag` and `AnyDiag`, which are `SchemaValidateDiagFunc` variants of `All` and `Any` ([#&#8203;1155](hashicorp/terraform-plugin-sdk#1155))
-   helper/validation: Added quoting in `StringInSlice` error diagnostic output to prevent confusion with values that contain spaces ([#&#8203;464](hashicorp/terraform-plugin-sdk#464))

### [`v2.28.0`](https://github.com/hashicorp/terraform-plugin-sdk/releases/tag/v2.28.0)

[Compare Source](hashicorp/terraform-plugin-sdk@v2.27.0...v2.28.0)

NOTES:

-   helper/schema: The `Resource` type `EnableApplyLegacyTypeSystemErrors` and `EnablePlanLegacyTypeSystemErrors` fields can be enabled to more easily discover resource data consistency errors which Terraform would normally demote to warning logs. Before enabling the flag in a production release for a resource, the resource should be exhaustively acceptance tested as there may be unrecoverable error situations for practitioners. It is recommended to first enable and test in environments where it is easy to clean up resources, potentially outside of Terraform. ([#&#8203;1227](hashicorp/terraform-plugin-sdk#1227))

ENHANCEMENTS:

-   helper/schema: Added `Resource` type `EnableLegacyTypeSystemApplyErrors` field, which will prevent Terraform from demoting data consistency errors to warning logs during `ApplyResourceChange` (`Create`, `Update`, and `Delete`) operations with the resource ([#&#8203;1227](hashicorp/terraform-plugin-sdk#1227))
-   helper/schema: Added `Resource` type `EnableLegacyTypeSystemPlanErrors` field, which can be used to prevent Terraform from demoting data consistency errors to warning logs during `PlanResourceChange` operations with the resource ([#&#8203;1227](hashicorp/terraform-plugin-sdk#1227))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi43OS4xIiwidXBkYXRlZEluVmVyIjoiMzYuNzkuMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Reviewed-on: https://gitea.com/gitea/terraform-provider-gitea/pulls/17
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
nfagerlund added a commit to hashicorp/terraform-provider-tfe that referenced this issue Oct 4, 2023
Providers implemented using the `terraform-plugin-go` library above version 0.19
or so must implement GetMetadata(), as part of supporting an optional memory
usage improvement. See
hashicorp/terraform-plugin-sdk#1234 for the start of a
breadcrumb trail with more details about this whole effort.

Almost nobody actually implements providers using terraform-plugin-go, but we
do! It's one of our THREE muxed-together providers, because we once needed to do
something that was impossible in the SDK before the new framework existed. It's
used for ONE data source, `tfe_outputs`.

This function was added (with a blank return value) in
#1046 and no one noticed
a problem, presumably because acceptance tests were running with a Terraform
version that didn't exercise the new memory-saving code path, instead just
calling GetProviderSchema however many times.

But, Terraform 1.6 *does* exercise it, and it turns out a blank value causes it
to bail out early with a not-found for the tfe_outputs data source.

This commit adds our lonely data source to the low-level provider's metadata,
which fixes the issue. Longer-term, we should... probably migrate that data
source to the framework and delete that whole third provider.
@github-actions
Copy link

github-actions bot commented Oct 7, 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 Oct 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
1 participant