Fix crash when group_list has content in network data

This commit is contained in:
Kienan Stewart 2020-10-24 21:26:54 -04:00
parent 8c17f720c8
commit a4a1bc5f1f
1 changed files with 28 additions and 26 deletions

View File

@ -8,93 +8,95 @@ import (
rapi "burntworld.ca/go-rapi-client"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func dataSourceNetworks() *schema.Resource {
return &schema.Resource {
return &schema.Resource{
ReadContext: dataSourceNetworksRead,
Schema: map[string]*schema.Schema {
Schema: map[string]*schema.Schema{
"networks": &schema.Schema{
Type: schema.TypeList,
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema {
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
Computed: true,
},
"ctime": &schema.Schema{
Type: schema.TypeFloat,
Type: schema.TypeFloat,
Computed: true,
},
"external_reservations": &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
Computed: true,
},
"free_count": &schema.Schema{
Type: schema.TypeInt,
Type: schema.TypeInt,
Computed: true,
},
"gateway": &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
Computed: true,
},
"gateway6": &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
Computed: true,
},
"group_list": &schema.Schema{
Type: schema.TypeList,
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema {
Type: schema.TypeString,
Elem: &schema.Schema{
Type: schema.TypeList,
Elemb: &schema.Schema{
Type: schema.TypeString,
},
},
},
"inst_list": &schema.Schema{
Type: schema.TypeList,
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema {
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"mac_prefix": &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
Computed: true,
},
"map": &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
Computed: true,
},
"mtime": &schema.Schema{
Type: schema.TypeFloat,
Type: schema.TypeFloat,
Computed: true,
},
"network": &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
Computed: true,
},
"network6": &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
Computed: true,
},
"reserved_count": &schema.Schema{
Type: schema.TypeInt,
Type: schema.TypeInt,
Computed: true,
},
"serial_no": &schema.Schema{
Type: schema.TypeInt,
Type: schema.TypeInt,
Computed: true,
},
"tags": &schema.Schema{
Type: schema.TypeList,
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema {
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"uuid": &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
Computed: true,
},
},