Skip to content

Commit efb2787

Browse files
author
Pedro Montiel
committed
admiral api changes
1 parent b5e2f44 commit efb2787

4 files changed

+49
-37
lines changed

sumologic/resource_sumologic_cse_inventory_entity_group_configuration.go

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,18 @@ func resourceSumologicCSEInventoryEntityGroupConfiguration() *schema.Resource {
2626
Optional: true,
2727
Default: "",
2828
},
29-
"groups": {
30-
Type: schema.TypeList,
29+
"group": {
30+
Type: schema.TypeString,
3131
Optional: true,
32-
Elem: &schema.Schema{
33-
Type: schema.TypeString,
34-
},
32+
Default: "",
3533
},
3634
"inventory_type": {
3735
Type: schema.TypeString,
38-
Optional: true,
39-
Default: "",
36+
Required: true,
37+
},
38+
"inventory_source": {
39+
Type: schema.TypeString,
40+
Required: true,
4041
},
4142
"name": {
4243
Type: schema.TypeString,
@@ -77,8 +78,9 @@ func resourceSumologicCSEInventoryEntityGroupConfigurationRead(d *schema.Resourc
7778

7879
d.Set("criticality", CSEInventoryEntityGroupConfigurationGet.Criticality)
7980
d.Set("description", CSEInventoryEntityGroupConfigurationGet.Description)
80-
d.Set("groups", CSEInventoryEntityGroupConfigurationGet.Groups)
81+
d.Set("group", CSEInventoryEntityGroupConfigurationGet.Group)
8182
d.Set("inventory_type", CSEInventoryEntityGroupConfigurationGet.InventoryType)
83+
d.Set("inventory_source", CSEInventoryEntityGroupConfigurationGet.InventorySource)
8284
d.Set("name", CSEInventoryEntityGroupConfigurationGet.Name)
8385
d.Set("suppressed", CSEInventoryEntityGroupConfigurationGet.Suppressed)
8486
d.Set("tags", CSEInventoryEntityGroupConfigurationGet.Tags)
@@ -98,13 +100,14 @@ func resourceSumologicCSEInventoryEntityGroupConfigurationCreate(d *schema.Resou
98100

99101
if d.Id() == "" {
100102
id, err := c.CreateCSEInventoryEntityGroupConfiguration(CSEEntityGroupConfiguration{
101-
Criticality: d.Get("criticality").(string),
102-
Description: d.Get("description").(string),
103-
Groups: resourceToStringArray(d.Get("groups").([]interface{})),
104-
InventoryType: d.Get("inventory_type").(string),
105-
Name: d.Get("name").(string),
106-
Suppressed: d.Get("suppressed").(bool),
107-
Tags: resourceToStringArray(d.Get("tags").([]interface{})),
103+
Criticality: d.Get("criticality").(string),
104+
Description: d.Get("description").(string),
105+
Group: d.Get("group").(string),
106+
InventoryType: d.Get("inventory_type").(string),
107+
InventorySource: d.Get("inventory_source").(string),
108+
Name: d.Get("name").(string),
109+
Suppressed: d.Get("suppressed").(bool),
110+
Tags: resourceToStringArray(d.Get("tags").([]interface{})),
108111
})
109112

110113
if err != nil {
@@ -137,13 +140,14 @@ func resourceToCSEInventoryEntityGroupConfiguration(d *schema.ResourceData) (CSE
137140
}
138141

139142
return CSEEntityGroupConfiguration{
140-
ID: id,
141-
Criticality: d.Get("criticality").(string),
142-
Description: d.Get("description").(string),
143-
Groups: resourceToStringArray(d.Get("groups").([]interface{})),
144-
InventoryType: d.Get("inventory_type").(string),
145-
Name: d.Get("name").(string),
146-
Suppressed: d.Get("suppressed").(bool),
147-
Tags: resourceToStringArray(d.Get("tags").([]interface{})),
143+
ID: id,
144+
Criticality: d.Get("criticality").(string),
145+
Description: d.Get("description").(string),
146+
Group: d.Get("group").(string),
147+
InventoryType: d.Get("inventory_type").(string),
148+
InventorySource: d.Get("inventory_source").(string),
149+
Name: d.Get("name").(string),
150+
Suppressed: d.Get("suppressed").(bool),
151+
Tags: resourceToStringArray(d.Get("tags").([]interface{})),
148152
}, nil
149153
}

sumologic/resource_sumologic_cse_inventory_entity_group_configuration_test.go

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ func TestAccSumologicCSEInventoryEntityGroupConfiguration_createAndUpdate(t *tes
1616
description := "Test description"
1717
group := "goo"
1818
inventoryType := "computer"
19+
inventorySource := "Active Directory"
1920
name := "Entity Group Configuration Tf test"
2021
suppressed := false
2122
tag := "foo"
@@ -29,21 +30,21 @@ func TestAccSumologicCSEInventoryEntityGroupConfiguration_createAndUpdate(t *tes
2930
Steps: []resource.TestStep{
3031
{
3132
Config: testCreateCSEInventoryEntityGroupConfigurationConfig(criticality, description, group,
32-
inventoryType, name, suppressed, tag),
33+
inventoryType, inventorySource, name, suppressed, tag),
3334
Check: resource.ComposeTestCheckFunc(
3435
testCheckCSEInventoryEntityGroupConfigurationExists(resourceName, &InventoryEntityGroupConfiguration),
3536
testCheckInventoryEntityGroupConfigurationValues(&InventoryEntityGroupConfiguration, criticality,
36-
description, group, inventoryType, name, suppressed, tag),
37+
description, group, inventoryType, inventorySource, name, suppressed, tag),
3738
resource.TestCheckResourceAttrSet(resourceName, "id"),
3839
),
3940
},
4041
{
4142
Config: testCreateCSEInventoryEntityGroupConfigurationConfig(criticality, description, group,
42-
inventoryType, nameUpdated, suppressed, tag),
43+
inventoryType, inventorySource, nameUpdated, suppressed, tag),
4344
Check: resource.ComposeTestCheckFunc(
4445
testCheckCSEInventoryEntityGroupConfigurationExists(resourceName, &InventoryEntityGroupConfiguration),
4546
testCheckInventoryEntityGroupConfigurationValues(&InventoryEntityGroupConfiguration, criticality,
46-
description, group, inventoryType, nameUpdated, suppressed, tag),
47+
description, group, inventoryType, inventorySource, nameUpdated, suppressed, tag),
4748
resource.TestCheckResourceAttrSet(resourceName, "id"),
4849
),
4950
},
@@ -77,18 +78,19 @@ func testAccCSEInventoryEntityGroupConfigurationDestroy(s *terraform.State) erro
7778

7879
func testCreateCSEInventoryEntityGroupConfigurationConfig(
7980
criticality string, description string, group string,
80-
inventoryType string, name string, suppressed bool, tag string) string {
81+
inventoryType string, inventorySource string, name string, suppressed bool, tag string) string {
8182
return fmt.Sprintf(`
8283
resource "sumologic_cse_inventory_entity_group_configuration" "inventory_entity_group_configuration" {
8384
criticality = "%s"
8485
description = "%s"
85-
groups = ["%s"]
86+
group = "%s"
8687
inventory_type = "%s"
88+
inventory_source = "%s"
8789
name = "%s"
8890
suppressed = %t
8991
tags = ["%s"]
9092
}
91-
`, criticality, description, group, inventoryType, name, suppressed, tag)
93+
`, criticality, description, group, inventoryType, inventorySource, name, suppressed, tag)
9294
}
9395

9496
func testCheckCSEInventoryEntityGroupConfigurationExists(n string, InventoryEntityGroupConfiguration *CSEEntityGroupConfiguration) resource.TestCheckFunc {
@@ -116,20 +118,23 @@ func testCheckCSEInventoryEntityGroupConfigurationExists(n string, InventoryEnti
116118

117119
func testCheckInventoryEntityGroupConfigurationValues(InventoryEntityGroupConfiguration *CSEEntityGroupConfiguration,
118120
criticality string, description string, group string,
119-
inventoryType string, name string, suppressed bool, tag string) resource.TestCheckFunc {
121+
inventoryType string, inventorySource string, name string, suppressed bool, tag string) resource.TestCheckFunc {
120122
return func(s *terraform.State) error {
121123
if InventoryEntityGroupConfiguration.Criticality != criticality {
122124
return fmt.Errorf("bad criticality, expected \"%s\", got %#v", criticality, InventoryEntityGroupConfiguration.Criticality)
123125
}
124126
if InventoryEntityGroupConfiguration.Description != description {
125127
return fmt.Errorf("bad description, expected \"%s\", got %#v", description, InventoryEntityGroupConfiguration.Description)
126128
}
127-
if InventoryEntityGroupConfiguration.Groups[0] != group {
128-
return fmt.Errorf("bad group, expected \"%s\", got %#v", tag, InventoryEntityGroupConfiguration.Groups[0])
129+
if InventoryEntityGroupConfiguration.Group != group {
130+
return fmt.Errorf("bad group, expected \"%s\", got %#v", tag, InventoryEntityGroupConfiguration.Group)
129131
}
130132
if InventoryEntityGroupConfiguration.InventoryType != inventoryType {
131133
return fmt.Errorf("bad inventoryType, expected \"%s\", got %#v", inventoryType, InventoryEntityGroupConfiguration.InventoryType)
132134
}
135+
if InventoryEntityGroupConfiguration.InventorySource != inventorySource {
136+
return fmt.Errorf("bad inventoryType, expected \"%s\", got %#v", inventorySource, InventoryEntityGroupConfiguration.InventorySource)
137+
}
133138
if InventoryEntityGroupConfiguration.Name != name {
134139
return fmt.Errorf("bad name, expected \"%s\", got %#v", name, InventoryEntityGroupConfiguration.Name)
135140
}

sumologic/sumologic_cse_entity_group_configuration.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ type CSEEntityGroupConfiguration struct {
120120
Description string `json:"description,omitempty"`
121121
EntityNamespace string `json:"entityNamespace,omitempty"`
122122
EntityType string `json:"entityType,omitempty"`
123-
Groups []string `json:"groups,omitempty"`
123+
Group string `json:"group,omitempty"`
124124
InventoryType string `json:"inventoryType,omitempty"`
125+
InventorySource string `json:"inventorySource,omitempty"`
125126
LastUpdated string `json:"lastUpdated,omitempty,omitempty"`
126127
LastUpdatedBy string `json:"lastUpdatedBy,omitempty,omitempty"`
127128
Name string `json:"name,omitempty"`

website/docs/r/cse_inventory_entity_group_configuration.html.markdown

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ description: |-
1010
resource "sumologic_cse_inventory_entity_group_configuration" "inventory_entity_group_configuration" {
1111
criticality = "HIGH"
1212
description = "Inventory entity group description"
13-
groups = ["admin"]
13+
group = "admin"
1414
inventory_type = "username"
15+
inventory_source = "Active Directory"
1516
name = "Inventory entity group configuration"
1617
suppressed = false
1718
tags = ["tag"]
@@ -24,8 +25,9 @@ The following arguments are supported:
2425

2526
- `criticality` - (Optional) The entity group configuration criticality Examples: "HIGH", "CRITICALITY".
2627
- `description` - (Optional) The entity group configuration description.
27-
- `groups` - (Optional) The entity group configuration groups list.
28-
- `inventory_type` - (Optional) The entity type Examples: "computer", "username".
28+
- `group` - (Optional) The entity group configuration inventory group.
29+
- `inventory_type` - (Required) The inventory type Examples: "computer", "username".
30+
- `inventory_source` - (Required) The inventory source Examples: "Active Directory", "Okta".
2931
- `name` - (Required) The entity group configuration name.
3032
- `suppresed` - (Optional) The entity group configuration suppressed value
3133
- `tags` - (Optional) The entity group configuration tags list.

0 commit comments

Comments
 (0)