Hello,
I need declare resource, but I don’t know if it correct
resource "xxx" "yyy" {
storage {
disks = [
{
scsi = "",
selected = 1,
},
]
nics = [
{
mac = "",
type = 1,
},
{
mac = "",
type = 0,
},
]
custom_pcis = [
{
pci = "",
selected = 1,
},
]
}
}
I have schema for this
rs.Schema["storage"] = &schema.Schema{
Type: schema.TypeSet,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"disks": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"scsi": {
Type: schema.TypeString,
Optional: true,
},
"selected": {
Type: schema.TypeBool,
Optional: true,
},
},
},
},
"nics": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"mac": {
Type: schema.TypeString,
Optional: true,
},
"type": {
Type: schema.TypeInt,
Optional: true,
},
},
},
},
"custom_pcis": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"pci": {
Type: schema.TypeString,
Optional: true,
},
"selected": {
Type: schema.TypeBool,
Optional: true,
},
},
},
},
},
},
}
But I get error
Error: Unsupported argument
on resource_test.tf line 23, in resource "xxx" "yyy":
23: disks = [
An argument named "disks" is not expected here. Did you mean to define a block
of type "disks"?
Where I’m wrong?