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
tfsdk: Migrate RequiresReplace()
, RequiresReplaceIf()
, and UseStateForUnknown()
plan modifier functions to the resource
package
#434
Conversation
…ateForUnknown()` plan modifier functions to the `resource` package Reference: #132 Reference: #365 Reference: #366 Reference: #432 Plan modification in the framework is a concept that only applies to managed resources via the protocol `PlanResourceChange` RPC. Following the migration of other `tfsdk` package types into separate `datasource`, `provider`, and `resource` packages, this change migrates the `RequiresReplace()`, `RequiresReplaceIf()` and `UseStateForUnknown()` plan modifier functions into the `resource` package. This change should be bundled in the same release as the package refactoring since it is similar in nature. This change has two immediate benefits: - Aligning the Go package placement tof these functions o hint to provider developers that these are only intended for managed resources. - For future refactoring this removes additional schema-based code imports from the `tfsdk` package, which could enable refactoring the schema logic into internal packages with potentially less breaking changes for provider developers by removing a source of import cycles. Provider developers should be able to update their code using find and replace operations using the table below: | Prior tfsdk Package Function | New resource Package Function | | --- | --- | | `tfsdk.RequiresReplace` | `resource.RequiresReplace` | | `tfsdk.RequiresReplaceIf` | `resource.RequiresReplaceIf` | | `tfsdk.UseStateForUnknown` | `resource.UseStateForUnknown` | To reduce framework maintainer review burden, this code migrations was primarily a lift and shift operation while most code and documentation updates were find and replace operations. The modifier types were unexported as exposing them should not be beneficial for provider developers and should help reduce the Go documentation surface area. The plan modifier unit testing was updated to use a `_test` package so it is verifying only exported functionality.
… package Reference: hashicorp/terraform-plugin-framework#434 Updated via: ```shell go get github.com/hashicorp/terraform-plugin-framework@a49c78775f1b82a054a4e2a0904375f95134873e go mod tidy ```
terraform-provider-corner changes: hashicorp/terraform-provider-corner#83 |
Just to explicitly say it out loud since I didn't mention in the original description, we cannot move |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
… package (#83) Reference: hashicorp/terraform-plugin-framework#434 Updated via: ```shell go get github.com/hashicorp/terraform-plugin-framework@51b944f8a359e8ca29efc8d22c6843a7deedfad9 go mod tidy ```
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Reference: #132
Reference: #365
Reference: #366
Reference: #432
Plan modification in the framework is a concept that only applies to managed resources via the protocol
PlanResourceChange
RPC. Following the migration of othertfsdk
package types into separatedatasource
,provider
, andresource
packages, this change migrates theRequiresReplace()
,RequiresReplaceIf()
andUseStateForUnknown()
plan modifier functions into theresource
package. This change should be bundled in the same release as the package refactoring since it is similar in nature.This change has two immediate benefits:
tfsdk
package, which could enable refactoring the schema logic into internal packages with potentially less breaking changes for provider developers by removing a source of import cycles.Provider developers should be able to update their code using find and replace operations using the table below:
tfsdk.RequiresReplace
resource.RequiresReplace
tfsdk.RequiresReplaceIf
resource.RequiresReplaceIf
tfsdk.UseStateForUnknown
resource.UseStateForUnknown
To reduce framework maintainer review burden, this code migrations was primarily a lift and shift operation while most code and documentation updates were find and replace operations. The modifier types were unexported as exposing them should not be beneficial for provider developers and should help reduce the Go documentation surface area. The plan modifier unit testing was updated to use a
_test
package so it is verifying only exported functionality.