Skip to content

Releases: hashicorp/terraform-plugin-framework

v0.11.1

15 Aug 08:46
Compare
Choose a tag to compare

BUG FIXES:

  • resource: Prevented Error Decoding Private State errors on resources previously managed by terraform-plugin-sdk (#452)

v0.11.0

11 Aug 15:49
330a87f
Compare
Choose a tag to compare

NOTES:

  • This Go module has been updated to Go 1.18 per the Go support policy. Any consumers building on earlier Go versions may experience errors. (#445)
  • tfsdk: The Schema type AttributeAtPath() method signature will be updated from a *tftypes.AttributePath parameter to path.Path in the next release. Switch to the AttributeAtTerraformPath() method if *tftypes.AttributePath handling is still necessary. (#440)
  • tfsdk: The Schema type AttributeType() method has been deprecated in preference of the Type() method. (#440)
  • tfsdk: The Schema type AttributeTypeAtPath() method has been deprecated for the TypeAtPath() and TypeAtTerraformPath() methods. (#440)
  • tfsdk: The Schema type TerraformType() method has been deprecated in preference of calling Type().TerraformType(). (#440)

BREAKING CHANGES:

  • tfsdk: Go types relating to data source handling have been migrated to the new datasource package. Consult the pull request description for a full listing of find-and-replace information. (#432)
  • tfsdk: Go types relating to provider handling have been migrated to the new provider package. Consult the pull request description for a full listing of find-and-replace information. (#432)
  • tfsdk: Go types relating to resource handling have been migrated to the new resource package. Consult the pull request description for a full listing of find-and-replace information. (#432)
  • tfsdk: The RequiresReplace(), RequiresReplaceIf(), and UseStateForUnknown() plan modifier functions, which only apply to managed resources, have been moved to the resource package. (#434)
  • tfsdk: The ResourceImportStatePassthroughID() function has been moved to resource.ImportStatePassthroughID(). (#432)
  • tfsdk: The Schema type AttributeAtPath method now returns a fwschema.Attribute interface instead of a tfsdk.Attribute type. Consumers will need to update from direct field usage to similarly named interface method calls. (#438)

FEATURES:

  • datasource: New package, which colocates all data source implementation types from the tfsdk package (#432)
  • provider: New package, which colocates all provider implementation types from the tfsdk package (#432)
  • resource: Enabled provider developers to read/write private state data. (#433)
  • resource: New package, which colocates all resource implementation types from the tfsdk package (#432)

ENHANCEMENTS:

  • tfsdk: Added Block type MaxItems and MinItems field validation for Terraform 0.12 through 0.15.1 (#422)

BUG FIXES:

  • internal/fwserver: Ensured UpgradeResourceState calls from Terraform 0.12 properly ignored attributes not defined in the schema (#426)
  • path: Ensured Expression type Copy() method appropriately copied root expressions and Equal() checked for root versus relative expressions (#420)

v0.10.0

18 Jul 19:57
e45e54f
Compare
Choose a tag to compare

BREAKING CHANGES:

  • attr: The TypeWithValidate interface has been moved under the attr/xattr package and the *tftypes.AttributePath parameter is replaced with path.Path (#390)
  • diag: The DiagnosticWithPath interface Path method *tftypes.AttributePath return is replaced with path.Path (#390)
  • diag: The Diagnostics type AddAttributeError and AddAttributeWarning method *tftypes.AttributePath parameters are replaced with path.Path (#390)
  • diag: The NewAttributeErrorDiagnostic and NewAttributeWarningDiagnostic function *tftypes.AttributePath parameters are replaced with path.Path (#390)
  • tfsdk: The Config, Plan, and State types GetAttribute and SetAttribute methods *tftypes.AttributePath parameters are replaced with path.Path (#390)
  • tfsdk: The DataSourceConfigValidator interface Validate method is now ValidateDataSource to support generic validators that satisfy DataSourceConfigValidator, ProviderConfigValidator, and ResourceConfigValidator (#405)
  • tfsdk: The ModifyAttributePlanRequest, ModifyResourcePlanResponse, and ValidateAttributeRequest type AttributePath *tftypes.AttributePath fields are replaced with AttributePath path.Path (#390)
  • tfsdk: The PlanResourceChange RPC on destroy is now enabled. To prevent unexpected Terraform errors, the framework attempts to catch errant provider logic in plan modifiers when destroying. Resource level plan modifiers may require updates to handle a completely null proposed new state (plan) and ensure it remains completely null on resource destruction. (#409)
  • tfsdk: The ProviderConfigValidator interface Validate method is now ValidateProvider to support generic validators that satisfy DataSourceConfigValidator, ProviderConfigValidator, and ResourceConfigValidator (#405)
  • tfsdk: The RequiresReplaceIf and ResourceImportStatePassthroughID function *tftypes.AttributePath parameters are replaced with path.Path (#390)
  • tfsdk: The ResourceConfigValidator interface Validate method is now ValidateResource to support generic validators that satisfy DataSourceConfigValidator, ProviderConfigValidator, and ResourceConfigValidator (#405)

FEATURES:

  • Support plan modifiers returning warning and error diagnostics on resource destruction with Terraform 1.3 and later (#409)
  • path: Introduced attribute path expressions (#396)
  • path: Introduced framework abstraction for attribute path handling (#390)

ENHANCEMENTS:

  • diag: Added Diagnostics type Equal() method (#402)
  • diag: ErrorsCount, WarningsCount, Errors and Warnings functions have been added to diag.Diagnostics (#392)
  • providerserver: Added sdk.proto logger request duration and response diagnostics logging (#398)
  • tfsdk: Added AttributePathExpression field to ModifyAttributePlanRequest and ValidateAttributeRequest types (#396)
  • tfsdk: Added PathMatches method to Config, Plan, and State types (#396)
  • tfsdk: Added framework-specific error diagnostics when Resource implementations errantly return no errors and empty state after Create and Update methods (#406)
  • types: Method IsNull() for Number type will now return true if the struct is zero-value initialized. (#384)

v0.9.0

15 Jun 20:24
Compare
Choose a tag to compare

BREAKING CHANGES:

  • attr: The Value interface now includes the IsNull() and IsUnknown() methods (#335)
  • attr: The Value interface now includes the String() method (#376)
  • tfsdk: ListNestedAttributes, SetNestedAttributes and MapNestedAttributes functions lost the second argument opts, as it was unused. (#349)

FEATURES:

  • providerserver: Implemented native protocol version 5 support (#368)

ENHANCEMENTS:

  • providerserver: Added NewProtocol5() and NewProtocol5WithError() functions, which return a protocol version 5 compatible provider server (#368)
  • providerserver: Added ServeOpts type ProtocolVersion field, which can be set to 5 or 6 and defaults to 6 (#368)
  • tfsdk: New function ValueFrom that takes a Go value and populates a compatible attr.Value, given a descriptive attr.Type. (#350)
  • tfsdk: Removed ListNestedAttributesOptions, SetNestedAttributesOptions and MapNestedAttributesOptions types, as they were empty (no fields) and unused. (#349)
  • types: Added IsNull() and IsUnknown() methods to all types (#335)
  • types: Added String() method to all types (#376)

BUG FIXES:

  • tfsdk: Prevented configuration handling error when Schema contained Blocks (#371)
  • types: Prevented panic being thrown when .ToTerraformValue is called on an attr.Value type where ElemType / AttrsType were not set. (#354)
  • types: Prevented potential loss of number precision with Int64 between 54 and 64 bits (#325)

v0.8.0

06 May 19:16
Compare
Choose a tag to compare

BREAKING CHANGES:

  • diag: Removed Diagnostics type ToTfprotov6Diagnostics() method. This was not intended for usage by provider developers. (#313)
  • tfsdk: The ModifySchemaPlanRequest, ModifySchemaPlanResponse, ValidateSchemaRequest, and ValidateSchemaResponse types have been removed. These were not intended for provider developer usage. (#310)
  • tfsdk: The NewProtocol6Server() function, Serve() function, and ServeOpts type have been removed. Use the providerserver package instead. (#310)
  • tfsdk: The ResourceImportStateNotImplemented() function has been removed. Remove the Resource type ImportState method instead for resources that should not support import. (#312)

ENHANCEMENTS:

  • tfsdk: Propagated tf_data_source_type, tf_req_id, tf_resource_type, and tf_rpc fields in log entries (#315)

BUG FIXES:

  • all: Prevented This log was generated by an SDK subsystem logger that wasn't created before being used. warning messages in logging (#314)
  • tfsdk: Prevented Unable to create logging subsystem with AdditionalLocationOffset due to missing root logger options warning logs during acceptance testing (#315)

v0.7.0

28 Apr 16:48
Compare
Choose a tag to compare

NOTES:

  • tfsdk: Providers may now optionally remove RemoveResource() calls from Resource type Delete methods (#301)
  • tfsdk: The NewProtocol6Server() function has been deprecated in preference of providerserver.NewProtocol6() and providerserver.NewProtocol6WithError() functions, which will simplify muxing and testing implementations. The tfsdk.NewProtocol6Server() function will be removed in the next minor version. (#308)
  • tfsdk: The ResourceImportStateNotImplemented() function has been deprecated. Instead, the ImportState method can be removed from the Resource and the framework will automatically return an error diagnostic if import is attempted. (#297)
  • tfsdk: The Resource interface no longer requires the ImportState method. A separate ResourceWithImportState interface now defines the same ImportState method. (#297)
  • tfsdk: The Serve() function has been deprecated in preference of the providerserver.Serve() function. The tfsdk.Serve() function will be removed in the next minor version. (#308)
  • tfsdk: The ServeOpts type has been deprecated in preference of the providerserver.ServeOpts type. When migrating, the Name field has been replaced with Address. The tfsdk.ServeOpts type will be removed in the next minor version. (#308)
  • tfsdk: The previously unexported server type has been temporarily exported to aid in the migration to the new providerserver package. It is not intended for provider developer usage and will be moved into an internal package in the next minor version. (#308)

FEATURES:

  • Introduced providerserver package, which contains all functions and types necessary for serving a provider in production or acceptance testing. (#308)
  • tfsdk: Added optional ResourceWithUpgradeState interface, which allows for provider defined logic when the UpgradeResourceState RPC is called (#292)

ENHANCEMENTS:

  • tfsdk: Added DEBUG level logging for all framework handoffs to provider defined logic (#300)
  • tfsdk: Added ResourceWithImportState interface, which allows Resource implementations to optionally define the ImportState method. (#297)
  • tfsdk: Added automatic (DeleteResourceResponse.State).RemoveResource() call after Resource type Delete method execution if there are no errors (#301)

v0.6.1

29 Mar 16:36
Compare
Choose a tag to compare

BUG FIXES:

  • types: Prevented panics with missing type information during Float64, Int64, and Set validation logic (#259)

v0.6.0

10 Mar 15:35
9e6e7ed
Compare
Choose a tag to compare

NOTES:

  • The underlying terraform-plugin-log dependency 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 ToTerraformValue method of the attr.Value interface now returns a tftypes.Value, instead of an interface{}. Existing types need to be updated to call tftypes.ValidateValue and tftypes.NewValue, passing the value they were returning before, instead of returning the value directly. (#231)
  • tfsdk: The ListNestedAttributesOptions, MapNestedAttributeOptions, and SetNestedAttributeOptions type MaxItems and MinItems fields 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.Value when using GetAttribute. (#232)
  • Logging can now be used by calling tflog.Trace, tflog.Debug, tflog.Info, tflog.Warn, or tflog.Error. See the tflog docs for more information. (#234)
  • tfsdk: Added Debug field to ServeOpts for running providers via debugger and testing processes (#243)

BUG FIXES:

  • tfsdk: Removed Schema restriction that it must contain at least one attribute or block (#252)
  • tfsdk: Support protocol version 5 and verify valid resource type in UpgradeResourceState RPC (#263)

v0.5.0

30 Nov 19:44
Compare
Choose a tag to compare

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 and AttributeWarningDiagnostic types have been removed. Any usage can be replaced with DiagnosticWithPath. (#219)
  • tfsdk: The AddAttributeError, AddAttributeWarning, AddError, and AddWarning methods on the ConfigureProviderResponse, CreateResourceResponse, DeleteResourceResponse, ModifyAttributePlanResponse, ModifyResourcePlanResponse, ReadDataSourceResponse, ReadResourceResponse, and UpdateResourceResponse types have been removed in preference of the same methods on the Diagnostics field of these types. For example, code such as resp.AddError("...", "...") can be updated to resp.Diagnostics.AddError("...", "..."). (#198)
  • tfsdk: The Config, Plan, and State type GetAttribute methods now return diagnostics only and require the target as the last parameter, similar to the Get 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, and State type GetAttribute methods can now be used to fetch values directly into attr.Value implementations and Go types. (#167)

BUG FIXES:

  • tfsdk: Fetch null values from valid missing Config, Plan, and State paths in GetAttribute() method (#185)
  • types: Ensure Float64 Type() method returns Float64Type (#202)
  • types: Prevent panic with uninitialized Number Value (#200)
  • types: Prevent panics when ValueFromTerraform received nil values (#208)

v0.4.2

29 Sep 14:12
Compare
Choose a tag to compare

BUG FIXES:

  • Fix bug in which updating Computed-only attributes would lead to a "Provider produced inconsistent result after apply" error (#176/#184)