You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/plugin/framework/acctests.mdx
+6-7
Original file line number
Diff line number
Diff line change
@@ -61,19 +61,18 @@ testing_new.go:53: no "id" found in attributes
61
61
62
62
To avoid this, add a root level `id` attribute to resource and data source schemas. Ensure the attribute value is appropriately [written to state](/plugin/framework/writing-state). Conventionally, `id` is a computed attribute that contains the identifier for the resource.
63
63
64
-
For example, in the `GetSchema` method implementation of a [`datasource.DataSource`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/datasource#DataSource) or [`resource.Resource`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/resource#Resource):
64
+
For example, in the `Schema` method implementation of a [`datasource.DataSource`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/datasource#DataSource) or [`resource.Resource`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/resource#Resource):
Copy file name to clipboardExpand all lines: website/docs/plugin/framework/migrating/attributes-blocks/blocks-computed.mdx
+23-26
Original file line number
Diff line number
Diff line change
@@ -36,41 +36,39 @@ map[string]*schema.Schema{
36
36
37
37
## Framework
38
38
39
-
In the Framework, when working with protocol version 5, computed blocks are implemented using an attribute with a `Type`
40
-
of `types.ListType` which has an `ElemType` of `types.ObjectType`.
39
+
In the Framework, when working with protocol version 5, computed blocks are implemented using a `ListAttribute` which has an `ElementType` of `types.ObjectType`.
41
40
42
41
```go
43
-
map[string]tfsdk.Attribute{
44
-
"example": {
42
+
map[string]schema.Attribute{
43
+
"example": schema.ListAttribute{
45
44
Computed: true,
46
-
Type: types.ListType{
47
-
ElemType: types.ObjectType{
48
-
AttrTypes: map[string]attr.Type{
49
-
"nested_example": types.StringType,
50
-
/* ... */
45
+
ElementType: types.ObjectType{
46
+
AttrTypes: map[string]attr.Type{
47
+
"nested_example": types.StringType,
48
+
/* ... */
51
49
52
50
```
53
51
54
52
In the Framework, when working with protocol version 6, we recommend that you define computed blocks using nested
55
-
attributes. This example shows usage of `ListNestedAttributes` as this provides configuration references with list index
56
-
syntax as is the case when using `schema.TypeList` in SDKv2. `SingleNestedAttributes` is a good choice for single
53
+
attributes. This example shows usage of `ListNestedAttribute` as this provides configuration references with list index
54
+
syntax as is the case when using `schema.TypeList` in SDKv2. `SingleNestedAttribute` is a good choice for single
57
55
underlying objects which results in a breaking change but also allows dropping `[0]` in configuration references.
- When using protocol version 5 specify `ElemType` as `types.ObjectType` when migrating blocks that are computed from SDKv2 to Framework.
71
+
- When using protocol version 5 specify `ElementType` as `types.ObjectType` when migrating blocks that are computed from SDKv2 to Framework.
74
72
- When using protocol version 6, use [nested attributes](/plugin/framework/schemas#attributes-1) when migrating blocks that are computed from SDKv2 to Framework.
75
73
76
74
## Example
@@ -111,12 +109,11 @@ This code defines the `certificates` block as an attribute on the `certificate`
111
109
`types.ObjectType` is being used to define the nested block.
0 commit comments