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
AttributeErrorDiagnostic
andAttributeWarningDiagnostic
types have been removed. Any usage can be replaced withDiagnosticWithPath
. (#219) - tfsdk: The
AddAttributeError
,AddAttributeWarning
,AddError
, andAddWarning
methods on theConfigureProviderResponse
,CreateResourceResponse
,DeleteResourceResponse
,ModifyAttributePlanResponse
,ModifyResourcePlanResponse
,ReadDataSourceResponse
,ReadResourceResponse
, andUpdateResourceResponse
types have been removed in preference of the same methods on theDiagnostics
field of these types. For example, code such asresp.AddError("...", "...")
can be updated toresp.Diagnostics.AddError("...", "...")
. (#198) - tfsdk: The
Config
,Plan
, andState
typeGetAttribute
methods now return diagnostics only and require the target as the last parameter, similar to theGet
method. (#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
, andState
typeGetAttribute
methods can now be used to fetch values directly intoattr.Value
implementations and Go types. (#167)
BUG FIXES:
- tfsdk: Fetch null values from valid missing
Config
,Plan
, andState
paths inGetAttribute()
method (#185) - types: Ensure
Float64
Type()
method returnsFloat64Type
(#202) - types: Prevent panic with uninitialized
Number
Value
(#200) - types: Prevent panics when
ValueFromTerraform
receivednil
values (#208)