Skip to content
This repository was archived by the owner on Jul 5, 2023. It is now read-only.

Commit b85a160

Browse files
committed
Add some missing info to the SDKv2 upgrade guide.
We missed some sections and have some new sections that needed to be added to the upgrade guide to v2 of the SDK. Closes hashicorp/terraform-plugin-sdk#493. Closes hashicorp/terraform-plugin-sdk#492. Closes hashicorp/terraform-plugin-sdk#487. Closes hashicorp/terraform-plugin-sdk#484.
1 parent 18be894 commit b85a160

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

content/source/docs/extend/guides/v2-upgrade-guide.html.md

+47-2
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,16 @@ Upgrade topics:
4444
* [More Robust Validation of `helper/resource.TestCheckResourceAttrPair`](#more-robust-validation-of-helper-resource-testcheckresourceattrpair)
4545
* [More Robust Validation of Test Sweepers](#more-robust-validation-of-test-sweepers)
4646
* [Deprecation of `helper/schema.ExistsFunc`](#deprecation-of-helper-schema-existsfunc)
47+
* [Deprecation of `helper/schema.SchemaValidateFunc`](#deprecation-of-helper-schema-schemavalidatefunc)
4748
* [Removal of `helper/mutexkv` Package](#removal-of-helper-mutexkv-package)
4849
* [Removal of `helper/pathorcontents` Package](#removal-of-helper-pathorcontents-package)
4950
* [Removal of `httpclient` Package](#removal-of-httpclient-package)
5051
* [Removal of `helper/hashcode` Package](#removal-of-helper-hashcode-package)
5152
* [Removal of the `acctest` Package](#removal-of-the-acctest-package)
5253
* [Removal of the `terraform.ResourceProvider` Interface](#removal-of-the-terraform-resourceprovider-interface)
54+
* [Removal of the `helper/schema.Provider.StopContext` method](#removal-of-the-helper-schema-provider-stopcontext-method)
55+
* [Removal of `helper/schema.ResourceData.SetPartial`](#removal-of-helper-schema-resourcedata-setpartial)
56+
* [Removal of the `helper/schema.Provider.MetaReset` property](#removal-of-the-helper-schema-provider-metareset-property)
5357
* [Removal of Deprecated Validation Functions](#removal-of-deprecated-validation-functions)
5458
* [Removal of `helper/schema.Schema.PromoteSingle`](#removal-of-helper-schema-schema-promotesingle)
5559
* [Removal of `helper/schema.ResourceData.UnsafeSetFieldRaw`](#removal-of-helper-schema-resourcedata-unsafesetfieldraw)
@@ -335,6 +339,18 @@ twice. Providers should check for Not Found responses in Read, and call
335339
`helper/schema.ResourceData.SetId(“”)` and return no errors if a Not Found
336340
response is encountered, instead.
337341

342+
## Deprecation of `helper/schema.SchemaValidateFunc`
343+
The `helper/schema.SchemaValidateFunc` type and the properties that use it,
344+
including `helper/schema.Schema.ValidateFunc`, are now deprecated in favor of
345+
`helper/schema.SchemaValidateDiagFunc`, which gains awareness for diagnostics,
346+
allowing more accurate errors to be returned.
347+
348+
The `helper/validation` helper functions will have
349+
`helper/schema.SchemaValidateDiagFunc` equivalents of the validation functions
350+
added in a future release to ease the transition. Until that point, a
351+
wrapper can be used that wraps the warnings and errors returned from
352+
`helper/schema.SchemaValidateFunc` in a `diag.Diagnostics`.
353+
338354
## Removal of `helper/mutexkv` Package
339355
The `helper/mutexkv` package provided convenience helpers for managing
340356
concurrency, but is not specifically related to Terraform plugin development,
@@ -509,6 +525,36 @@ this will involve changing the returned type of the `Provider()` function, and
509525
removing some type assertions; all necessary changes should be raised at
510526
compile time.
511527

528+
## Removal of the `helper/schema.Provider.StopContext` method
529+
530+
The `helper/schema.Provider.StopContext` method has been removed as its
531+
implementation has been reconfigured. Use `helper/schema.StopContext`, passed a
532+
`context.Context` originate from one of the new context-aware functions,
533+
instead.
534+
535+
## Removal of `helper/schema.ResourceData.SetPartial`
536+
537+
The `helper/schema.ResourceData.SetPartial` method was deprecated and has been
538+
removed. This method used to allow setting certain fields in state when
539+
`helper/schema.ResourceData.Partial` was set to `true`, but developers weren't
540+
clear under which circumstances that needed to happen.
541+
542+
This method should never need to be used. `helper/schema.ResourceData.Partial`
543+
should be set to `true` before returning an error if the error should prevent
544+
any state from being part of the config being automatically persisted in state.
545+
For most providers, this doesn't matter, as the refresh step will take care of
546+
setting the state to what it should be.
547+
548+
See [issue #476](https://github.com/hashicorp/terraform-plugin-sdk/issues/476)
549+
for more information.
550+
551+
## Removal of the `helper/schema.Provider.MetaReset` property
552+
553+
The `helper/schema.Provider.MetaReset` property allowed providers to set a
554+
function tha would be called during testing to reset the `meta` associated with
555+
the provider. This function was never actually called, and so the property has
556+
been removed.
557+
512558
## Removal of Deprecated Validation Functions
513559
The following `helper/validation` functions have been renamed, and the
514560
deprecated aliases have been removed:
@@ -566,11 +612,9 @@ their use case, and we can help find a path forward.
566612

567613
* `helper/acctest.RemoteTestPrecheck`
568614
* `helper/acctest.SkipRemoteTestsEnvVar`
569-
* `helper/resource.EnvLogPathMask`
570615
* `helper/resource.GRPCTestProvider`
571616
* `helper/resource.LogOutput`
572617
* `helper/resource.Map`
573-
* `helper/resource.TestEnvVar`
574618
* `helper/resource.TestProvider`
575619
* `helper/schema.MultiMapReader`
576620
* `helper/schema.Provider.Input`
@@ -614,6 +658,7 @@ their use case, and we can help find a path forward.
614658
* `plugin.UIOutputServer`
615659
* `plugin.VersionedPlugins no longer has a "provisioner" key`
616660
* `resource.RunNewTest`
661+
* `resource.TestDisableBinaryTestingFlagEnvVar`
617662
* `schema.Backend`
618663
* `schema.FromContextBackendConfig`
619664
* `schema.SetProto5`

0 commit comments

Comments
 (0)