I am using below schema for the resource.
"demo_attribute": schema.ListNestedAttribute{
Optional: true,
Computed: true,
Description: "",
MarkdownDescription: "",
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: "",
MarkdownDescription: "",
Optional: true,
Computed: true,
},
"name": schema.StringAttribute{
Description: "",
MarkdownDescription: "",
Optional: true,
Computed: true,
},
"port": schema.Int64Attribute{
Description: "",
MarkdownDescription: "",
Optional: true,
Computed: true,
},
"list1": schema.SetAttribute{
Description: "",
MarkdownDescription: "",
ElementType: types.StringType,
Required: true,
},
"list2": schema.SetAttribute{
Description: "",
MarkdownDescription: "",
ElementType: types.StringType,
Optional: true,
Computed: true,
},
"role": schema.StringAttribute{
Required: true,
Description: "",
MarkdownDescription: "",
},
},
},
},
The model structure is as follows:
type DemoResourceModel struct {
DemoAttribute types.List `tfsdk:"demo_attribute"`
}
type Demo struct {
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
Port types.Int64 `tfsdk:"port"`
List1 types.Set `tfsdk:"list1"`
List2 types.Set `tfsdk:"list2"`
Role types.String `tfsdk:"role"`
}
I am facing an issue while saving the List1 and List2 attributes in the state. Is there any way to save such a structure in the state?