Skip to content

Commit 22ae5d0

Browse files
author
Pedro Montiel
committed
including review feedback
1 parent 6f6b96d commit 22ae5d0

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

sumologic/resource_sumologic_cse_insights_configuration.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,11 @@ func resourceToCSEInsightsConfiguration(d *schema.ResourceData) (CSEInsightsConf
9898
return CSEInsightsConfiguration{}, nil
9999
}
100100

101-
return CSEInsightsConfiguration{
101+
lookbackDays := d.Get("lookback_days").(float64)
102+
threshold := d.Get("threshold").(float64)
102103

103-
LookbackDays: d.Get("lookback_days").(float64),
104-
Threshold: d.Get("threshold").(float64),
104+
return CSEInsightsConfiguration{
105+
LookbackDays: &lookbackDays,
106+
Threshold: &threshold,
105107
}, nil
106108
}

sumologic/resource_sumologic_cse_insights_configuration_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func testAccCSEInsightsConfigurationDestroy(s *terraform.State) error {
4747
return fmt.Errorf("Encountered an error: " + err.Error())
4848
}
4949
if s != nil {
50-
if s.Threshold != 0 && s.LookbackDays != 0 {
50+
if s.Threshold != nil && s.LookbackDays != nil {
5151
return fmt.Errorf("insight Configuration still exists")
5252
}
5353
}
@@ -89,10 +89,10 @@ func testCheckCSEInsightsConfigurationExists(n string, insightConfiguration *CSE
8989

9090
func testCheckInsightsConfigurationValues(insightConfiguration *CSEInsightsConfiguration, nLookbackDays float64, nThreshold float64) resource.TestCheckFunc {
9191
return func(s *terraform.State) error {
92-
if insightConfiguration.LookbackDays != nLookbackDays {
92+
if *insightConfiguration.LookbackDays != nLookbackDays {
9393
return fmt.Errorf("bad lookback days, expected \"%f\", got: %#v", nLookbackDays, insightConfiguration.LookbackDays)
9494
}
95-
if insightConfiguration.Threshold != nThreshold {
95+
if *insightConfiguration.Threshold != nThreshold {
9696
return fmt.Errorf("bad threshold, expected \"%f\", got: %#v", nThreshold, insightConfiguration.Threshold)
9797
}
9898

sumologic/sumologic_cse_insights_configuration.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ type CSEInsightsConfigurationResponse struct {
4444
}
4545

4646
type CSEInsightsConfiguration struct {
47-
LookbackDays float64 `json:"lookbackDays,omitempty"`
48-
Threshold float64 `json:"threshold,omitempty"`
47+
LookbackDays *float64 `json:"lookbackDays,omitempty"`
48+
Threshold *float64 `json:"threshold,omitempty"`
4949
}

website/docs/r/cse_insights_configuration.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: "sumologic"
33
page_title: "SumoLogic: sumologic_cse_insights_configuration"
44
description: |-
5-
Provides a CSE Insights Configuration
5+
Provides the CSE Insights Configuration for the whole organization. There can be only one configuration per organization.
66
---
77

88
# sumologic_cse_insights_configuration

0 commit comments

Comments
 (0)