NOTES:
- tfsdk: Providers may now optionally remove
RemoveResource()calls fromResourcetypeDeletemethods (#301) - tfsdk: The
NewProtocol6Server()function has been deprecated in preference ofproviderserver.NewProtocol6()andproviderserver.NewProtocol6WithError()functions, which will simplify muxing and testing implementations. Thetfsdk.NewProtocol6Server()function will be removed in the next minor version. (#308) - tfsdk: The
ResourceImportStateNotImplemented()function has been deprecated. Instead, theImportStatemethod can be removed from theResourceand the framework will automatically return an error diagnostic if import is attempted. (#297) - tfsdk: The
Resourceinterface no longer requires theImportStatemethod. A separateResourceWithImportStateinterface now defines the sameImportStatemethod. (#297) - tfsdk: The
Serve()function has been deprecated in preference of theproviderserver.Serve()function. Thetfsdk.Serve()function will be removed in the next minor version. (#308) - tfsdk: The
ServeOptstype has been deprecated in preference of theproviderserver.ServeOptstype. When migrating, theNamefield has been replaced withAddress. Thetfsdk.ServeOptstype will be removed in the next minor version. (#308) - tfsdk: The previously unexported
servertype has been temporarily exported to aid in the migration to the newproviderserverpackage. It is not intended for provider developer usage and will be moved into an internal package in the next minor version. (#308)
FEATURES:
- Introduced
providerserverpackage, which contains all functions and types necessary for serving a provider in production or acceptance testing. (#308) - tfsdk: Added optional
ResourceWithUpgradeStateinterface, which allows for provider defined logic when theUpgradeResourceStateRPC is called (#292)
ENHANCEMENTS:
- tfsdk: Added
DEBUGlevel logging for all framework handoffs to provider defined logic (#300) - tfsdk: Added
ResourceWithImportStateinterface, which allowsResourceimplementations to optionally define theImportStatemethod. (#297) - tfsdk: Added automatic
(DeleteResourceResponse.State).RemoveResource()call afterResourcetypeDeletemethod execution if there are no errors (#301)
BUG FIXES:
- types: Prevented panics with missing type information during
Float64,Int64, andSetvalidation logic (#259)
NOTES:
- The underlying
terraform-plugin-logdependency has been updated to v0.3.0, which includes a breaking change in the optional additional fields parameter of logging function calls to ensure correctness and catch coding errors during compilation. Any early adopter provider logging which calls those functions may require updates. (#268)
BREAKING CHANGES:
- The
ToTerraformValuemethod of theattr.Valueinterface now returns atftypes.Value, instead of aninterface{}. Existing types need to be updated to calltftypes.ValidateValueandtftypes.NewValue, passing the value they were returning before, instead of returning the value directly. (#231) - tfsdk: The
ListNestedAttributesOptions,MapNestedAttributeOptions, andSetNestedAttributeOptionstypeMaxItemsandMinItemsfields have been removed since the protocol and framework never supported this type of nested attribute validation. Use attribute validators instead. (#249)
ENHANCEMENTS:
- Added the ability to get an attribute as a generic
attr.Valuewhen usingGetAttribute. (#232) - Logging can now be used by calling
tflog.Trace,tflog.Debug,tflog.Info,tflog.Warn, ortflog.Error. See the tflog docs for more information. (#234) - tfsdk: Added
Debugfield toServeOptsfor running providers via debugger and testing processes (#243)
BUG FIXES:
- tfsdk: Removed
Schemarestriction that it must contain at least one attribute or block (#252) - tfsdk: Support protocol version 5 and verify valid resource type in
UpgradeResourceStateRPC (#263)
BREAKING CHANGES:
- Fixed RequiresReplace and RequiresReplaceIf to be more judicious about when they require a resource to be destroyed and recreated. They will no longer require resources to be recreated when any attribute changes, instead limiting it only to the attribute they're declared on. They will also not require resources to be recreated when they're being created or deleted. Finally, they won't require a resource to be recreated if the user has no value in the config for the attribute and the attribute is computed; this is to prevent the resource from being destroyed and recreated when the provider changes the value without any user prompting. Providers that wish to destroy and recreate the resource when an optional and computed attribute is removed from the user's config should do so in their own plan modifier. (#213)
- RequiresReplaceIf no longer overrides previous plan modifiers' value for RequiresReplace if the function returns false. (#213)
- diag: The
AttributeErrorDiagnosticandAttributeWarningDiagnostictypes have been removed. Any usage can be replaced withDiagnosticWithPath. (#219) - tfsdk: The
AddAttributeError,AddAttributeWarning,AddError, andAddWarningmethods on theConfigureProviderResponse,CreateResourceResponse,DeleteResourceResponse,ModifyAttributePlanResponse,ModifyResourcePlanResponse,ReadDataSourceResponse,ReadResourceResponse, andUpdateResourceResponsetypes have been removed in preference of the same methods on theDiagnosticsfield of these types. For example, code such asresp.AddError("...", "...")can be updated toresp.Diagnostics.AddError("...", "..."). (#198) - tfsdk: The
Config,Plan, andStatetypeGetAttributemethods now return diagnostics only and require the target as the last parameter, similar to theGetmethod. (#167)
FEATURES:
- Added
tfsdk.UseStateForUnknown()as a built-in plan modifier, which will automatically replace an unknown value in the plan with the value from the state. This mimics the behavior of computed and optional+computed values in Terraform Plugin SDK versions 1 and 2. Provider developers will likely want to use it for "write-once" attributes that never change once they're set in state. (#204) - tfsdk: Support list and set blocks in schema definitions (#188)
ENHANCEMENTS:
- diag: Added
WithPath()function to wrap or overwrite diagnostic path information. (#219) - tfsdk: The
Config,Plan, andStatetypeGetAttributemethods can now be used to fetch values directly intoattr.Valueimplementations and Go types. (#167)
BUG FIXES:
- tfsdk: Fetch null values from valid missing
Config,Plan, andStatepaths inGetAttribute()method (#185) - types: Ensure
Float64Type()method returnsFloat64Type(#202) - types: Prevent panic with uninitialized
NumberValue(#200) - types: Prevent panics when
ValueFromTerraformreceivednilvalues (#208)
BUG FIXES:
- Fix bug in which updating
Computed-only attributes would lead to a "Provider produced inconsistent result after apply" error (#176/#184)
NOTES:
- Upgraded to terraform-plugin-go v0.4.0 which contains its own breaking changes. Please see https://github.com/hashicorp/terraform-plugin-go/blob/main/CHANGELOG.md#040-september-24-2021 for more details. (#179)
BREAKING CHANGES:
attr.Typeimplementations must now have aString()method that returns a human-friendly name for the type. (#120)- tfsdk:
Resourceimplementations must now include theImportState(context.Context, ImportResourceStateRequest, *ImportResourceStateResponse)method. If import is not supported, call theResourceImportStateNotImplemented()function or return an error. (#149)
FEATURES:
- tfsdk: Support resource import (#149)
- types: Support
SetandSetType(#126) - types: Support for
Float64,Float64Type,Int64, andInt64Type(#166)
ENHANCEMENTS:
- Added a
tfsdk.ConvertValuehelper that will convert anyattr.Valueinto any compatibleattr.Type. Compatibility happens at the terraform-plugin-go level; the type that theattr.Value'sToTerraformValuemethod produces must be compatible with theattr.Type'sTerraformType(). Generally, this means that theattr.Typeof theattr.Valueand theattr.Typebeing converted to must both produce the sametftypes.Typewhen theirTerraformType()method is called. (#120)
BUG FIXES:
- attr: Ensure
Listtypes implementingattr.TypeWithValidatecallElementTypevalidation only if that type implementsattr.TypeWithValidate(#126) - tfsdk:
(Plan).SetAttribute()and(State).SetAttribute()will now create missing attribute paths instead of silently failing to update. (#165)
BREAKING CHANGES:
- Methods on the
tfsdk.Config,tfsdk.Plan, andtfsdk.Statetypes now return[]*tfprotov6.Diagnosticinstead oferror(#82) - Most uses of
[]*tfprotov6.Diagnostichave been replaced with a newdiag.Diagnosticstype. Please update your type signatures, and use one of thediags.New*helper functions instead of constructing*tfprotov6.Diagnostics by hand. (#110) - The
schema.Attributeandschema.Schematypes have been moved totfsdk.Attributeandtfsdk.Schema. No changes beyond import names are required. (#77) - With the release of Go 1.17, Go 1.17 is now the lowest supported version of Go to use with terraform-plugin-framework. (#104)
attr.Valueimplementations must now implement aType(context.Context)method that returns theattr.Typethat created theattr.Value. (#119)
FEATURES:
- Added support for ModifyPlan functions on Resources. (#90)
- Introduced first-class diagnostics (
diagpackage). (#110) - Support
attr.Typevalidation (#82) - tfsdk: Attributes, Data Sources, Providers, and Resources now support configuration validation (#75)
ENHANCEMENTS:
- Added a
tfsdk.ValueAshelper that allows accessing anattr.Valuewithout type assertion, by using the same reflection rules used in theConfig.Get,Plan.Get, andState.Gethelpers. (#119) - Errors from methods on the
tfsdk.Config,tfsdk.Plan, andtfsdk.Statetypes now include rich diagnostic information (#82) - tfsdk: Validate
Attributedefines at least one ofRequired,Optional, orComputed(#111)
BUG FIXES:
- tfsdk: Diagnostics returned from
(Plan).SetAttribute()and(State).SetAttribute()reflection will now properly include attribute path (#133) - tfsdk: Don't attempt validation on the nested attributes of a null or unknown
SingleNestedAttribute(#118) - tfsdk: Return warning diagnostic when using
AttributeorSchematypeDeprecationMessagefield (#93)
ENHANCEMENTS:
- Added
tfsdk.NewProtocol6Serverto return atfprotov6.ProviderServerimplementation for testing and muxing purposes. (#72) - Added support for MapNestedAttributes. (#79)
- Responses now default to returning the current state, meaning state will only change when provider developers actively change it. Previously, an empty state value would be returned, which caused problems. (#74)
FEATURES:
- Added interfaces extending the attr.Type interface to include attribute and element types. (#44)
- Added state, config, and plan types, and support for getting values from them. (#46)
- Added support for Object types. (#38)
- Added support for bools, numbers, and strings. (#29)
- Added support for defining schemas and attributes. (#27)
- Added support for lists. (#36)
- Added support for maps. (#37)
- Added support for provider, resource, and data source types. (#32)
- Added the ability to serve providers. (#45)