Skip to content

Commit

Permalink
Fix in data_source_nutanix_address_groups schema.
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharth-kulshrestha authored and siddharth-nutanix committed Feb 11, 2022
1 parent 9490457 commit c65cc26
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions nutanix/data_source_nutanix_address_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ func dataSourceNutanixAddressGroups() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"address_group": {
Type: schema.TypeMap,
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Expand Down Expand Up @@ -93,7 +94,7 @@ func dataSourceNutanixAddressGroups() *schema.Resource {
},
},
"associated_policies_list": {
Type: schema.TypeMap,
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -147,15 +148,16 @@ func flattenAddressGroup(entries []*v3.AddressGroupListEntry) interface{} {

for i, entry := range entries {
entities[i] = map[string]interface{}{
"address_group": map[string]interface{}{
"name": entry.AddressGroup.Name,
"description": entry.AddressGroup.Description,
"address_group_string": entry.AddressGroup.AddressGroupString,
"ip_address_block_list": flattenAddressEntry(entry.AddressGroup.BlockList),
"address_group": []map[string]interface{}{
{
"name": entry.AddressGroup.Name,
"description": entry.AddressGroup.Description,
"address_group_string": entry.AddressGroup.AddressGroupString,
"ip_address_block_list": flattenAddressEntry(entry.AddressGroup.BlockList),
},
},
"associated_policies_list": flattenReferenceList(entry.AssociatedPoliciesList),
}
}

return entities
}

0 comments on commit c65cc26

Please sign in to comment.