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,18 +8,17 @@ import (
rapi "burntworld.ca/go-rapi-client" rapi "burntworld.ca/go-rapi-client"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
) )
func dataSourceNetworks() *schema.Resource { func dataSourceNetworks() *schema.Resource {
return &schema.Resource { return &schema.Resource{
ReadContext: dataSourceNetworksRead, ReadContext: dataSourceNetworksRead,
Schema: map[string]*schema.Schema { Schema: map[string]*schema.Schema{
"networks": &schema.Schema{ "networks": &schema.Schema{
Type: schema.TypeList, Type: schema.TypeList,
Computed: true, Computed: true,
Elem: &schema.Resource{ Elem: &schema.Resource{
Schema: map[string]*schema.Schema { Schema: map[string]*schema.Schema{
"name": &schema.Schema{ "name": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
@ -47,14 +46,17 @@ func dataSourceNetworks() *schema.Resource {
"group_list": &schema.Schema{ "group_list": &schema.Schema{
Type: schema.TypeList, Type: schema.TypeList,
Computed: true, Computed: true,
Elem: &schema.Schema { Elem: &schema.Schema{
Type: schema.TypeList,
Elemb: &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
}, },
}, },
},
"inst_list": &schema.Schema{ "inst_list": &schema.Schema{
Type: schema.TypeList, Type: schema.TypeList,
Computed: true, Computed: true,
Elem: &schema.Schema { Elem: &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
}, },
}, },
@ -89,7 +91,7 @@ func dataSourceNetworks() *schema.Resource {
"tags": &schema.Schema{ "tags": &schema.Schema{
Type: schema.TypeList, Type: schema.TypeList,
Computed: true, Computed: true,
Elem: &schema.Schema { Elem: &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
}, },
}, },