I am using below schema for the resource.
"demo_attribute": schema.SingleNestedAttribute{
Required: true,
Description: "",
MarkdownDescription: "",
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: "",
MarkdownDescription: "",
Optional: true,
Computed: true,
},
"name": schema.StringAttribute{
Description: "",
MarkdownDescription: "",
Optional: true,
Computed: true,
},
"attr1": schema.Int64Attribute{
Description: "",
MarkdownDescription: "",
Computed: true,
},
"list1": schema.SetAttribute{
Description: "",
MarkdownDescription: "",
ElementType: types.StringType,
Optional: true,
Computed: true,
},
"list2": schema.SetAttribute{
Description: "",
MarkdownDescription: "",
ElementType: types.StringType,
Computed: true,
},
},
},
},
The model structure is as follows:
type DemoResourceModel struct {
DemoAttribute ????? `tfsdk:"demo_attribute"`
}
type Demo struct {
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
Attr1 types.Int64 `tfsdk:"attr1"`
List1 types.Set `tfsdk:"list1"`
List2 types.Set `tfsdk:"list2"`
}
What can be the type in struct Demo for DemoAttribute? I can’t use the Demo type since its giving an error while reading the state in ModifyPlan.