Attribute Types
An attribute either contains a primitive type, such as an integer or a string, or contains other attributes. Attributes that contain other attributes are referred to as nested attributes. Refer to Schemas - Attributes in the Framework documentation for details.
This page explains how to migrate a primitive attribute from SDKv2 to the plugin Framework. For an example of migrating a nested block to a nested attribute, refer to Providers in this guide.
SDKv2
In SDKv2, attribute types are defined by the Type
field on the attribute's schema.Schema
struct.
Framework
In the Framework, you set your attribute's type with the attribute's schema.Attribute
implementation.
Migration Notes
Remember the following differences between SDKv2 and the Framework when completing the migration.
- In the Framework, the
schema.Attribute
implementation determines the required details.
Examples
SDKv2
The following example shows the implementation of the type field of the example_string_attribute
attribute
for the exampleDataSource
data source with SDKv2.
Framework
The following example shows how the type of the example_string_attribute
attribute for the exampleDataSource
data
source is defined with the Framework after the migration.
SDKv2
The following example shows the implementation of the type field of the example_list_attribute
attribute with SDKv2.
Framework
The following example shows how the type of the example_list_attribute
attribute for the exampleResource
resource
is defined with the Framework after the migration.
Refer to Terraform Concepts - Attributes for further examples of different types of schema attributes in the Framework.