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

Update hashicorp/terraform-plugin-framework, terraform-plugin-mux, terraform-plugin-sdk/v2 to navigate breaking change in provider-defined functions #2087

Conversation

modular-magician
Copy link
Collaborator

This PR upgrades the provider functions to use Errors instead of Diagnostics - this is a breaking change introduced in plugin-framework 1.6.0 . By addressing it now I want to avoid navigating those changes after a function is released.

Impact of the change is that provider-defined functions cannot issue warnings anymore, only errors. I've replaced use of warnings with debug logs.

I wanted the debug log to include information about which function was making the log. This required some refactoring about where we set the function's name, to make it accessible in the Run logic of the individual functions.

Release Note Template for Downstream PRs (will be copied)

provider: updated all provider-defined functions to use new error reporting behaviour set by hashicorp/terraform-plugin-framework v1.6.0. Information about ambiguous input values will now be reported by debug logs, instead of warnings.

Derived from GoogleCloudPlatform/magic-modules#10109

…rraform-plugin-sdk/v2 to navigate breaking change in provider-defined functions (#10109)

* Update dependencies to include `hashicorp/terraform-plugin-framework@1.6.0`

This diff is the result of running:
* go get github.com/hashicorp/terraform-plugin-framework@v1.6.0
* go get github.com/hashicorp/terraform-plugin-mux@v0.15.0
* go get github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0
* go mod tidy

* Update reused 'element from id' logic to use errors instead of diagnostics. Remove use of warnings as a result, opt for debug log instead.

* Update project and location from id functions to use errors

* Update region_from_zone function to use errors

* Update zone_from_id function to use errors

* Update region_from_id function to use errors

* Upgrade to hashicorp/terraform-plugin-framework v1.6.1

* go get hashicorp/terraform-plugin-framework v1.6.1
* go mod tidy

* Improve logging in X_from_id functions when multiple regex matches are found

* Fix defect in name_from_id acc test

* Update name_from_id function to use errors & use new logging approach

* Remove use of Go 1.21 toolchain feature from go.mod

* Replace use of tflog with log in provider-defined functions

[upstream:f0f29d2702ea01d138615ff87f43194c21379525]

Signed-off-by: Modular Magician <magic-modules@google.com>
@modular-magician modular-magician requested a review from a team as a code owner March 22, 2024 21:27
@modular-magician modular-magician requested review from melinath and removed request for a team March 22, 2024 21:27
Copy link

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@modular-magician modular-magician merged commit bb855ab into GoogleCloudPlatform:FEATURE-BRANCH-provider-functions Mar 22, 2024
5 checks passed
@modular-magician modular-magician deleted the downstream-pr-f0f29d2702ea01d138615ff87f43194c21379525 branch November 18, 2024 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant