Skip to content

Added Jira dedup functionality for savedsearches #211

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions client/models/saved_searches.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ type SavedSearchObject struct {
ActionJiraServiceDeskParamJiraSummary string `json:"action.jira_service_desk.param.jira_summary,omitempty" url:"action.jira_service_desk.param.jira_summary"`
ActionJiraServiceDeskParamJiraPriority string `json:"action.jira_service_desk.param.jira_priority,omitempty" url:"action.jira_service_desk.param.jira_priority"`
ActionJiraServiceDeskParamJiraDescription string `json:"action.jira_service_desk.param.jira_description,omitempty" url:"action.jira_service_desk.param.jira_description"`
ActionJiraServiceDeskParamJiraDedup string `json:"action.jira_service_desk.param.jira_dedup,omitempty" url:"action.jira_service_desk.param.jira_dedup"`
ActionJiraServiceDeskParamJiraCustomfields string `json:"action.jira_service_desk.param.jira_customfields,omitempty" url:"action.jira_service_desk.param.jira_customfields"`
ActionWebhookParamUrl string `json:"action.webhook.param.url,omitempty" url:"action.webhook.param.url"`
AlertDigestMode bool `json:"alert.digest_mode" url:"alert.digest_mode"`
Expand Down
1 change: 1 addition & 0 deletions docs/resources/saved_searches.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ This resource block supports the following arguments:
* `action_jira_service_desk_param_jira_summary` - (Optional) Jira issue title/summary
* `action_jira_service_desk_param_jira_priority` - (Optional) Jira priority of issue
* `action_jira_service_desk_param_jira_description` - (Optional) Jira issue description
* `action_jira_service_desk_param_jira_dedup` - (Optional) Allows enabling of Jira Ticket dedup behavior
* `action_jira_service_desk_param_jira_customfields` - (Optional) Jira custom fields data (see https://ta-jira-service-desk-simple-addon.readthedocs.io/en/latest/userguide.html)
* `action_webhook_param_url` - (Optional) URL to send the HTTP POST request to. Must be accessible from the Splunk server
* `actions` - (Optional) A comma-separated list of actions to enable. For example: rss,email
Expand Down
1 change: 0 additions & 1 deletion splunk/resource_splunk_configs_conf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ func TestAccCreateSplunkConfigsConfSpecialChars(t *testing.T) {
})
}


func testAccSplunkConfigsConfDestroyResources(s *terraform.State) error {
client, err := newTestClient()
if err != nil {
Expand Down
21 changes: 13 additions & 8 deletions splunk/resource_splunk_saved_searches.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
)

func suppressDefault(defaultValue string) schema.SchemaDiffSuppressFunc {
return func(k, old, new string, d *schema.ResourceData) bool {
return old == defaultValue && new == ""
}
return func(k, old, new string, d *schema.ResourceData) bool {
return old == defaultValue && new == ""
}
}

func savedSearches() *schema.Resource {
Expand Down Expand Up @@ -676,9 +676,9 @@ func savedSearches() *schema.Resource {
Description: "Jira Issue Type you would like to create",
},
"action_jira_service_desk_param_jira_summary": {
Type: schema.TypeString,
Optional: true,
Description: "Jira Issue Summary or title",
Type: schema.TypeString,
Optional: true,
Description: "Jira Issue Summary or title",
DiffSuppressFunc: suppressDefault("Splunk Alert: $name$"),
},
"action_jira_service_desk_param_jira_priority": {
Expand All @@ -687,10 +687,15 @@ func savedSearches() *schema.Resource {
Description: "Priority of issue created",
},
"action_jira_service_desk_param_jira_description": {
Type: schema.TypeString,
Optional: true,
Description: "Enter the description of issue created",
DiffSuppressFunc: suppressDefault("The alert condition for '$name$' was triggered."),
},
"action_jira_service_desk_param_jira_dedup": {
Type: schema.TypeString,
Optional: true,
Description: "Enter the description of issue created",
DiffSuppressFunc: suppressDefault("The alert condition for '$name$' was triggered."),
Description: "Enables Jira ticket deduplication",
},
"action_jira_service_desk_param_jira_customfields": {
Type: schema.TypeString,
Expand Down
2 changes: 2 additions & 0 deletions splunk/resource_splunk_saved_searches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ resource "splunk_saved_searches" "test" {
action_jira_service_desk_param_jira_summary = "error message"
action_jira_service_desk_param_jira_priority = "Normal"
action_jira_service_desk_param_jira_description = "test ticket creation"
action_jira_service_desk_param_jira_dedup = "enabled"
action_jira_service_desk_param_jira_customfields = "\"customfield_10058\":{\"value\":\"custom_field_value_1\"},\"customfield_10046\":{\"value\":\"custom_field_value_2\"}"
alert_comparator = "greater than"
alert_digest_mode = true
Expand Down Expand Up @@ -467,6 +468,7 @@ func TestAccSplunkSavedSearches(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "action_jira_service_desk_param_jira_summary", "error message"),
resource.TestCheckResourceAttr(resourceName, "action_jira_service_desk_param_jira_priority", "Normal"),
resource.TestCheckResourceAttr(resourceName, "action_jira_service_desk_param_jira_description", "test ticket creation"),
resource.TestCheckResourceAttr(resourceName, "action_jira_service_desk_param_jira_dedup", "enabled"),
resource.TestCheckResourceAttr(resourceName, "action_jira_service_desk_param_jira_customfields", "\"customfield_10058\":{\"value\":\"custom_field_value_1\"},\"customfield_10046\":{\"value\":\"custom_field_value_2\"}"),
resource.TestCheckResourceAttr(resourceName, "alert_comparator", "greater than"),
resource.TestCheckResourceAttr(resourceName, "alert_digest_mode", "true"),
Expand Down