Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix saved searches alert_track datatype #64

Merged
merged 1 commit into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/models/saved_searches.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ type SavedSearchObject struct {
AlertSuppress bool `json:"alert.suppress" url:"alert.suppress"`
AlertSuppressFields string `json:"alert.suppress.fields,omitempty" url:"alert.suppress.fields,omitempty"`
AlertSuppressPeriod string `json:"alert.suppress.period,omitempty" url:"alert.suppress.period,omitempty"`
AlertTrack string `json:"alert.track,omitempty" url:"alert.track,omitempty"`
AlertTrack bool `json:"alert.track" url:"alert.track"`
AlertComparator string `json:"alert_comparator,omitempty" url:"alert_comparator,omitempty"`
AlertCondition string `json:"alert_condition,omitempty" url:"alert_condition,omitempty"`
AlertThreshold string `json:"alert_threshold,omitempty" url:"alert_threshold,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions splunk/resource_splunk_saved_searches.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ func savedSearches() *schema.Resource {
"Use [number][time-unit] to specify a time. For example: 60 = 60 seconds, 1m = 1 minute, 1h = 60 minutes = 1 hour. ",
},
"alert_track": {
Type: schema.TypeString,
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: "Valid values: (true | false | auto) Specifies whether to track the actions triggered by this scheduled search." +
Expand Down Expand Up @@ -1545,7 +1545,7 @@ func getSavedSearchesConfig(d *schema.ResourceData) (savedSearchesObj *models.Sa
AlertSuppressFields: d.Get("alert_suppress_fields").(string),
AlertSuppressPeriod: d.Get("alert_suppress_period").(string),
AlertThreshold: d.Get("alert_threshold").(string),
AlertTrack: d.Get("alert_track").(string),
AlertTrack: d.Get("alert_track").(bool),
AlertType: d.Get("alert_type").(string),
AutoSummarize: d.Get("auto_summarize").(bool),
AutoSummarizeCommand: d.Get("auto_summarize_command").(string),
Expand Down
4 changes: 4 additions & 0 deletions splunk/resource_splunk_saved_searches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ resource "splunk_saved_searches" "test" {
action_email_subject = "Splunk Alert: $name$"
action_email_to = "[email protected]"
action_email_track_alert = true
alert_track = true
dispatch_earliest_time = "rt-15m"
dispatch_latest_time = "rt-0m"
dispatch_index_earliest = "-10m"
Expand Down Expand Up @@ -52,6 +53,7 @@ resource "splunk_saved_searches" "test" {
action_email_subject = "Splunk Alert: $name$"
action_email_to = "[email protected]"
action_email_track_alert = true
alert_track = true
dispatch_earliest_time = "rt-15m"
dispatch_latest_time = "rt-0m"
dispatch_index_earliest = "-20m"
Expand Down Expand Up @@ -184,6 +186,7 @@ func TestAccSplunkSavedSearches(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "action_email_subject", "Splunk Alert: $name$"),
resource.TestCheckResourceAttr(resourceName, "action_email_to", "[email protected]"),
resource.TestCheckResourceAttr(resourceName, "action_email_track_alert", "true"),
resource.TestCheckResourceAttr(resourceName, "alert_track", "true"),
resource.TestCheckResourceAttr(resourceName, "dispatch_earliest_time", "rt-15m"),
resource.TestCheckResourceAttr(resourceName, "dispatch_latest_time", "rt-0m"),
resource.TestCheckResourceAttr(resourceName, "dispatch_index_earliest", "-10m"),
Expand All @@ -209,6 +212,7 @@ func TestAccSplunkSavedSearches(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "action_email_subject", "Splunk Alert: $name$"),
resource.TestCheckResourceAttr(resourceName, "action_email_to", "[email protected]"),
resource.TestCheckResourceAttr(resourceName, "action_email_track_alert", "true"),
resource.TestCheckResourceAttr(resourceName, "alert_track", "true"),
resource.TestCheckResourceAttr(resourceName, "dispatch_earliest_time", "rt-15m"),
resource.TestCheckResourceAttr(resourceName, "dispatch_latest_time", "rt-0m"),
resource.TestCheckResourceAttr(resourceName, "dispatch_index_earliest", "-20m"),
Expand Down