From f72bdf4ee6879a4b5d52691c98110e1e8ea73287 Mon Sep 17 00:00:00 2001 From: Jayanta Kashyap Date: Mon, 21 Mar 2022 18:55:01 +0530 Subject: [PATCH 01/10] updated SDO TF script for PagerDutyV3 --- .../outputs.tf | 38 +++++++- .../pagerduty.auto.tfvars | 8 -- .../pagerduty.tf | 33 +------ .../providers.tf | 2 +- .../sdo_app_artifacts/sdo_fer.txt | 14 ++- .../sumologic.auto.tfvars | 3 +- .../sumologic_collection_content.tf | 27 +++++- .../sumologic_fer.auto.tfvars | 7 +- .../sumologic_fer.tf | 19 +++- .../sumologic_webhooks.tf | 26 +++++- .../test/go.mod | 1 + .../test/go.sum | 2 + .../test/integration_test.go | 93 +++++++++++++++---- .../variables.tf | 21 ++++- .../versions.tf | 5 +- 15 files changed, 218 insertions(+), 81 deletions(-) delete mode 100644 software-development-optimization-terraform/pagerduty.auto.tfvars diff --git a/software-development-optimization-terraform/outputs.tf b/software-development-optimization-terraform/outputs.tf index be2f8eb3..44fa7109 100644 --- a/software-development-optimization-terraform/outputs.tf +++ b/software-development-optimization-terraform/outputs.tf @@ -53,8 +53,20 @@ output "circleci_orb_workflow_source_id" { # value = sumologic_folder.folder.path # } -output "sumo_pagerduty_webhook_id" { - value = sumologic_connection.pagerduty_connection.*.id +output "sumo_pagerduty_v2_webhook_id" { + value = sumologic_connection.pagerduty_v2_connection.*.id +} + +output "sumo_pagerduty_v3_webhook_id" { + value = sumologic_connection.pagerduty_v3_connection.*.id +} + +output "sumo_pagerduty_v2_webhook_integration_key" { + value = pagerduty_service_integration.sumologic_v2_service.*.integration_key +} + +output "sumo_pagerduty_v3_webhook_integration_key" { + value = pagerduty_service_integration.sumologic_v3_service.*.integration_key } output "sumo_opsgenie_webhook_id" { @@ -81,10 +93,22 @@ output "opsgenie_webhook_id" { value = restapi_object.ops_to_sumo_webhook.*.id } -output "pagerduty_webhook_id" { +output "pagerduty_v2_webhook_id" { value = pagerduty_extension.sumologic_extension.*.id } +output "pagerduty_v3_service_webhook_id" { + value = pagerduty_webhook_subscription.service_webhook.*.id +} + +output "pagerduty_v3_account_webhook_id" { + value = pagerduty_webhook_subscription.account_webhook.*.id +} + +output "pagerduty_v3_team_webhook_id" { + value = pagerduty_webhook_subscription.team_webhook.*.id +} + # output "github_repo_webhook_id" { # value = "${zipmap(github_repository_webhook.github_sumologic_repo_webhook.*.repository, github_repository_webhook.github_sumologic_repo_webhook.*.id)}" # } @@ -121,8 +145,12 @@ output "jira_issues_fer_id" { value = sumologic_field_extraction_rule.jira_issues_fer.*.id } -output "pagerduty_alerts_fer_id" { - value = sumologic_field_extraction_rule.pagerduty_alerts_fer.*.id +output "pagerduty_alerts_v2_fer_id" { + value = sumologic_field_extraction_rule.pagerduty_alerts_v2_fer.*.id +} + +output "pagerduty_alerts_v3_fer_id" { + value = sumologic_field_extraction_rule.pagerduty_alerts_v3_fer.*.id } output "github_pr_fer_id" { diff --git a/software-development-optimization-terraform/pagerduty.auto.tfvars b/software-development-optimization-terraform/pagerduty.auto.tfvars deleted file mode 100644 index c91d667e..00000000 --- a/software-development-optimization-terraform/pagerduty.auto.tfvars +++ /dev/null @@ -1,8 +0,0 @@ -# Sumo Logic - SDO Terraform -# Configure Pagerduty credentials and parameters. - -# Please replace (including brackets) with your Pagerduty key, to generate the key, refer: https://support.pagerduty.com/docs/generating-api-keys#section-generating-a-general-access-rest-api-key -pagerduty_api_key = "" -# Please replace and (including > brackets) with your Pagerduty service IDs. You can get these from the URL after opening a specific service. These are used for Pagerduty to Sumo Logic webhooks. -# Examples: ["P6HHD","PHGBUY"] or ["P76GFB"] -pagerduty_services_pagerduty_webhooks = ["", ""] \ No newline at end of file diff --git a/software-development-optimization-terraform/pagerduty.tf b/software-development-optimization-terraform/pagerduty.tf index 26a3ebf7..42176e58 100644 --- a/software-development-optimization-terraform/pagerduty.tf +++ b/software-development-optimization-terraform/pagerduty.tf @@ -1,37 +1,6 @@ -# Sumo Logic - SDO Terraform - -# This script creates Webhooks to Sumo Logic in Pagerduty Services. -# Configure the Pagerduty credentials in the pagerduty.auto.tfvars. - # Configure the Pagerduty Provider + provider "pagerduty" { skip_credentials_validation = "true" token = var.pagerduty_api_key } - -data "pagerduty_extension_schema" "webhook" { - count = "${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all" ? length(var.pagerduty_services_pagerduty_webhooks) : 0 - name = "Generic V2 Webhook" -} - -# Create Webhook in Pagerduty -resource "pagerduty_extension" "sumologic_extension" { - count = length(data.pagerduty_extension_schema.webhook) > 0 && "${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all" ? length(var.pagerduty_services_pagerduty_webhooks) : 0 - name = "Sumo Logic Webhook" - endpoint_url = sumologic_http_source.pagerduty[0].url - extension_schema = data.pagerduty_extension_schema.webhook[0].id - extension_objects = [var.pagerduty_services_pagerduty_webhooks[count.index]] -} - -data "pagerduty_vendor" "sumologic" { - count = "${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all" ? length(var.pagerduty_services_pagerduty_webhooks) : 0 - name = "Sumo Logic" -} - -# We need to create Service Key for each service for Sumo Logic to Pagerduty Webhook -resource "pagerduty_service_integration" "sumologic_service" { - count = length(data.pagerduty_vendor.sumologic) > 0 && "${var.install_sumo_to_pagerduty_webhook}" ? length(var.pagerduty_services_sumo_webhooks) : 0 - name = data.pagerduty_vendor.sumologic[0].name - service = var.pagerduty_services_sumo_webhooks[count.index] - vendor = data.pagerduty_vendor.sumologic[0].id -} \ No newline at end of file diff --git a/software-development-optimization-terraform/providers.tf b/software-development-optimization-terraform/providers.tf index 4eaf996f..a0428fcc 100644 --- a/software-development-optimization-terraform/providers.tf +++ b/software-development-optimization-terraform/providers.tf @@ -6,7 +6,7 @@ terraform { template = "~> 2.1" # jira = "~> 0.1.11" github = "~> 2.8" - pagerduty = "~> 1.7" + pagerduty = "~> 2.3" sumologic = "~> 2.1.0" gitlab ="3.6.0" } diff --git a/software-development-optimization-terraform/sdo_app_artifacts/sdo_fer.txt b/software-development-optimization-terraform/sdo_app_artifacts/sdo_fer.txt index 0df6d3dd..071c9f77 100644 --- a/software-development-optimization-terraform/sdo_app_artifacts/sdo_fer.txt +++ b/software-development-optimization-terraform/sdo_app_artifacts/sdo_fer.txt @@ -205,7 +205,7 @@ commit_id, reviewers, updated_date, head_commit_id nodrop | if (alert_type matches "*Create", "alert_created", if(alert_type matches "*Close", "alert_closed", "other") ) as event_type " }, - "PagerDuty": { + "PagerDutyV2": { "Scope": "_sourcecategory=Labs/pagerduty_v2 ("incident.trigger" or "incident.resolve" )", "Parse": "parse regex "(?\{\"event\":\"incident\..+?\}(?=,\{\"event\":\"incident\..+|\]\}$))" |json field=event "event", "created_on", "incident" as alert_type, @@ -220,6 +220,18 @@ link | if (alert_type matches "*trigger", "alert_created", if(alert_type matches "*resolve", "alert_closed", "other") ) as event_type " } + "PagerDutyV3":{ + "Scope": "_sourceCategory=Labs/pagerduty_v3 ("incident.triggered" or "incident.resolved")", + "Parse": "json "event.event_type","event.data","event.occurred_at" as alert_type,incident,closeddate nodrop +| json field=incident "id", "service.summary" , "urgency", +"teams[*].summary", "html_url","created_at" as alert_id, service, priority, team, +link,dateTime nodrop +| where alert_type in ("incident.triggered", "incident.resolved") +| parseDate(closeddate, "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'","etc/utc") as closeddate_epoch +| parse regex field=dateTime "(?.{19})" +| parseDate(dateTime,"yyyy-MM-dd'T'HH:mm:ss","etc/utc") as dateTime_epoch +| if (alert_type matches "*triggered", "alert_created", if(alert_type matches "*resolved", "alert_closed", "other") ) as event_type" + } } }, { diff --git a/software-development-optimization-terraform/sumologic.auto.tfvars b/software-development-optimization-terraform/sumologic.auto.tfvars index 1e69f359..b128b4ec 100644 --- a/software-development-optimization-terraform/sumologic.auto.tfvars +++ b/software-development-optimization-terraform/sumologic.auto.tfvars @@ -28,10 +28,11 @@ install_jira_server = "all" install_bitbucket_cloud = "all" install_opsgenie = "all" install_pagerduty = "all" +install_pagerduty_version = "v3" install_github = "all" install_gitlab = "all" install_jenkins = "all" -install_sdo = "app" +install_sdo = "all" install_circleci_SDO_plugin = "all" install_circleci = "all" diff --git a/software-development-optimization-terraform/sumologic_collection_content.tf b/software-development-optimization-terraform/sumologic_collection_content.tf index bb318105..496e5287 100644 --- a/software-development-optimization-terraform/sumologic_collection_content.tf +++ b/software-development-optimization-terraform/sumologic_collection_content.tf @@ -245,12 +245,12 @@ resource "null_resource" "install_Opsgenie_app" { } } -# Install Pagerduty App -resource "null_resource" "install_pagerduty_app" { - count = "${var.install_pagerduty}" == "app" || "${var.install_pagerduty}" == "all" ? 1 : 0 +# Install PagerdutyV2 App +resource "null_resource" "install_pagerduty_v2_app" { + count = ("${var.install_pagerduty}" == "app" && "${var.install_pagerduty_version}" == "v2") || ("${var.install_pagerduty}" == "all" && "${var.install_pagerduty_version}" == "v2") ? 1 : 0 depends_on = [sumologic_http_source.pagerduty] triggers = { - version = var.pagerduty_version + version = var.pagerduty_v2_version } provisioner "local-exec" { @@ -264,6 +264,25 @@ resource "null_resource" "install_pagerduty_app" { } } +# Install PagerdutyV3 App +resource "null_resource" "install_pagerduty_v3_app" { + count = ("${var.install_pagerduty}" == "app" && "${var.install_pagerduty_version}" == "v3") || ("${var.install_pagerduty}" == "all" && "${var.install_pagerduty_version}" == "v3") ? 1 : 0 + depends_on = [sumologic_http_source.pagerduty] + triggers = { + version = var.pagerduty_v3_version + } + + provisioner "local-exec" { + command = <.+?)\\\",\\\"\" \n| \"n/a\" as team\n| json \"issue.fields.resolutiondate\", \"issue.fields.created\" as closedDate, dateTime \n| parseDate(dateTime, \"yyyy-MM-dd'T'HH:mm:ss.SSSZ\") as datetime_epoch\n| if (isNull(closeddate) , 00000000000, parseDate(closedDate, \"yyyy-MM-dd'T'HH:mm:ss.SSSZ\") ) as closeddate_epoch\n| toLong(closeddate_epoch)\n| \"issue\" as event_type\n" -pagerduty_alerts_fer_scope = "(\"incident.trigger\" or \"incident.resolve\" )" -pagerduty_alerts_fer_parse = "parse regex \"(?\\{\\\"event\\\":\\\"incident\\..+?\\}(?=,\\{\\\"event\\\":\\\"incident\\..+|\\]\\}$))\" \n|json field=event \"event\", \"created_on\", \"incident\" as alert_type,\ndateTime, incident\n|json field=incident \"id\", \"service.name\" , \"urgency\",\n\"teams[0].summary\", \"html_url\" as alert_id, service, priority, team,\nlink\n|json field=incident \"created_at\" as closeddate nodrop\n| where alert_type in (\"incident.trigger\", \"incident.resolve\")\n| parseDate(dateTime, \"yyyy-MM-dd'T'HH:mm:ss'Z'\") as dateTime_epoch\n| parseDate(closeddate, \"yyyy-MM-dd'T'HH:mm:ss'Z'\") as closeddate_epoch\n| if (alert_type matches \"*trigger\", \"alert_created\", if(alert_type matches \"*resolve\", \"alert_closed\", \"other\") ) as event_type\n" +pagerduty_alerts_v2_fer_scope = "(\"incident.trigger\" or \"incident.resolve\" )" +pagerduty_alerts_v2_fer_parse = "parse regex \"(?\\{\\\"event\\\":\\\"incident\\..+?\\}(?=,\\{\\\"event\\\":\\\"incident\\..+|\\]\\}$))\" \n|json field=event \"event\", \"created_on\", \"incident\" as alert_type,\ndateTime, incident\n|json field=incident \"id\", \"service.name\" , \"urgency\",\n\"teams[0].summary\", \"html_url\" as alert_id, service, priority, team,\nlink\n|json field=incident \"created_at\" as closeddate nodrop\n| where alert_type in (\"incident.trigger\", \"incident.resolve\")\n| parseDate(dateTime, \"yyyy-MM-dd'T'HH:mm:ss'Z'\") as dateTime_epoch\n| parseDate(closeddate, \"yyyy-MM-dd'T'HH:mm:ss'Z'\") as closeddate_epoch\n| if (alert_type matches \"*trigger\", \"alert_created\", if(alert_type matches \"*resolve\", \"alert_closed\", \"other\") ) as event_type\n" + +pagerduty_alerts_v3_fer_scope = "(\"incident.triggered\" or \"incident.resolved\")" +pagerduty_alerts_v3_fer_parse = "json \"event.event_type\",\"event.data\",\"event.occurred_at\" as alert_type,incident,closeddate nodrop\n| json field=incident \"id\", \"service.summary\" , \"urgency\",\n\"teams[*].summary\", \"html_url\",\"created_at\" as alert_id, service, priority, team,\nlink,dateTime nodrop\n| where alert_type in (\"incident.triggered\", \"incident.resolved\")\n| parseDate(closeddate, \"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\",\"etc/utc\") as closeddate_epoch\n| parse regex field=dateTime \"(?.{19})\"\n| parseDate(dateTime,\"yyyy-MM-dd'T'HH:mm:ss\",\"etc/utc\") as dateTime_epoch\n| if (alert_type matches \"*triggered\", \"alert_created\", if(alert_type matches \"*resolved\", \"alert_closed\", \"other\") ) as event_type\n" gitlab_pull_request_fer_scope = " %\"x-gitlab-event\"=\"Merge Request Hook\" " gitlab_pull_request_fer_parse = "json \"object_attributes.action\",\"object_attributes.state\" ,\"object_attributes.title\", \"object_attributes.created_at\",\"object_attributes.updated_at\",\"user.name\",\"project.name\",\"object_attributes.target_branch\" ,\"object_attributes.url\",\"assignees[*].name\",\"object_attributes.merge_commit_sha\",\"repository.name\",\"project.path_with_namespace\",\"object_attributes.last_commit.id\" as action,status, title,createddatetime, updateddatetime_epoch,user,project_name,target_branch,link,reviewers,commit_id,repository_name,team, head_commit_id nodrop\n| parse regex field=team \"(?.+)\\/.+\" \n| if (status matches \"opened\", \"created\", if(status matches \"merged\", \"merged\", if(status matches \"closed\", \"declined\", \"other\"))) as status\n| parseDate(createddatetime, \"yyyy-MM-dd HH:mm:ss\",\"etc/utc\") as datetime_epoch\n| parseDate(updateddatetime_epoch, \"yyyy-MM-dd HH:mm:ss\",\"etc/utc\") as updateddatetime_epoch\n|if(status in (\"declined\",\"merged\") ,updateddatetime_epoch,000000000)as closeddate_epoch\n| project_name as service\n| toLong(datetime_epoch)\n| toLong(closeddate_epoch)\n| \"pull_request\" as event_type\n" diff --git a/software-development-optimization-terraform/sumologic_fer.tf b/software-development-optimization-terraform/sumologic_fer.tf index abdf23fa..b6c24dd4 100644 --- a/software-development-optimization-terraform/sumologic_fer.tf +++ b/software-development-optimization-terraform/sumologic_fer.tf @@ -97,12 +97,21 @@ resource "sumologic_field_extraction_rule" "jira_issues_fer" { enabled = true } -resource "sumologic_field_extraction_rule" "pagerduty_alerts_fer" { - count = "${var.install_pagerduty}" == "fer" || "${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all" ? 1 : 0 +resource "sumologic_field_extraction_rule" "pagerduty_alerts_v2_fer" { + count = ("${var.install_pagerduty}" == "fer" || "${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v2" ? 1 : 0 depends_on = [sumologic_http_source.pagerduty] - name = "SDO - Pagerduty Alerts" - scope = "_sourceCategory=${var.pagerduty_sc} ${var.pagerduty_alerts_fer_scope}" - parse_expression = var.pagerduty_alerts_fer_parse + name = "SDO - Pagerduty V2 Alerts" + scope = "_sourceCategory=${var.pagerduty_sc} ${var.pagerduty_alerts_v2_fer_scope}" + parse_expression = var.pagerduty_alerts_v2_fer_parse + enabled = true +} + +resource "sumologic_field_extraction_rule" "pagerduty_alerts_v3_fer" { + count = ("${var.install_pagerduty}" == "fer" || "${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3" ? 1 : 0 + depends_on = [sumologic_http_source.pagerduty] + name = "SDO - Pagerduty V3 Alerts" + scope = "_sourceCategory=${var.pagerduty_sc} ${var.pagerduty_alerts_v3_fer_scope}" + parse_expression = var.pagerduty_alerts_v3_fer_parse enabled = true } diff --git a/software-development-optimization-terraform/sumologic_webhooks.tf b/software-development-optimization-terraform/sumologic_webhooks.tf index 29912ba5..4feef8fe 100644 --- a/software-development-optimization-terraform/sumologic_webhooks.tf +++ b/software-development-optimization-terraform/sumologic_webhooks.tf @@ -2,7 +2,7 @@ # Configure the Sumo Logic credentials in the sumologic.auto.tvars and other system credentials in respective files. # Create/Delete Sumo Logic to Pagerduty Webhook -resource "sumologic_connection" "pagerduty_connection" { +resource "sumologic_connection" "pagerduty_v2_connection" { count = length(data.pagerduty_vendor.sumologic) > 0 && "${var.install_sumo_to_pagerduty_webhook}" ? length(var.pagerduty_services_sumo_webhooks) : 0 type = "WebhookConnection" name = "Pagerduty Connection for Service - ${var.pagerduty_services_sumo_webhooks[count.index]}" @@ -14,7 +14,29 @@ resource "sumologic_connection" "pagerduty_connection" { default_payload = < 0 && "${var.install_sumo_to_pagerduty_webhook}" ? length(var.pagerduty_services_sumo_webhooks) : 0 + type = "WebhookConnection" + name = "Pagerduty Connection for Service - ${var.pagerduty_services_sumo_webhooks[count.index]}" + description = "Created via Sumo Logic SDO Terraform Script." + url = "https://events.pagerduty.com/generic/2010-04-15/create_event.json" + headers = { + "X-Header" : "Token token=${var.pagerduty_api_key}" + } + + default_payload = < Date: Mon, 21 Mar 2022 19:08:27 +0530 Subject: [PATCH 02/10] updated SDO default --- .../sumologic.auto.tfvars | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/software-development-optimization-terraform/sumologic.auto.tfvars b/software-development-optimization-terraform/sumologic.auto.tfvars index b128b4ec..513ceec8 100644 --- a/software-development-optimization-terraform/sumologic.auto.tfvars +++ b/software-development-optimization-terraform/sumologic.auto.tfvars @@ -32,7 +32,7 @@ install_pagerduty_version = "v3" install_github = "all" install_gitlab = "all" install_jenkins = "all" -install_sdo = "all" +install_sdo = "app" install_circleci_SDO_plugin = "all" install_circleci = "all" From c99a1cd793fec31835d1e8d626bb3c85ff04048e Mon Sep 17 00:00:00 2001 From: Jayanta Kashyap Date: Mon, 21 Mar 2022 19:22:44 +0530 Subject: [PATCH 03/10] updated app installation for v3 --- .../sumologic_collection_content.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/software-development-optimization-terraform/sumologic_collection_content.tf b/software-development-optimization-terraform/sumologic_collection_content.tf index 496e5287..c1e58537 100644 --- a/software-development-optimization-terraform/sumologic_collection_content.tf +++ b/software-development-optimization-terraform/sumologic_collection_content.tf @@ -278,7 +278,7 @@ resource "null_resource" "install_pagerduty_v3_app" { --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ -u ${var.sumo_access_id}:${var.sumo_access_key} \ - --data-raw '{ "name": "Pagerduty V3", "description": "The Sumo Logic App for PagerDuty V3 collects incident messages from your PagerDuty account via a webhook, and displays that incident data in pre-configured Dashboards, so you can monitor and analyze the activity of your PagerDuty account and Services.", "destinationFolderId": "${data.external.folder_data_json.result.id}","dataSourceValues": {"logsrcpd": "_sourceCategory = ${var.pagerduty_sc}"}}' + --data-raw '{ "name": "Pagerduty V3", "description": "The Sumo Logic App for PagerDuty V3 collects incident messages from your PagerDuty account via a webhook, and displays that incident data in pre-configured Dashboards, so you can monitor and analyze the activity of your PagerDuty account and Services.", "destinationFolderId": "${data.external.folder_data_json.result.id}","dataSourceValues": {"logsrc": "_sourceCategory = ${var.pagerduty_sc}"}}' EOT } } From 598cdabd5942f2674a00749d26bd88ddf0a45e25 Mon Sep 17 00:00:00 2001 From: Jayanta Kashyap Date: Mon, 21 Mar 2022 19:41:07 +0530 Subject: [PATCH 04/10] added new files --- .../pagerdutyv2.auto.tfvars | 8 ++ .../pagerdutyv2.tf | 31 +++++ .../pagerdutyv3.auto.tfvars | 12 ++ .../pagerdutyv3.tf | 131 ++++++++++++++++++ 4 files changed, 182 insertions(+) create mode 100644 software-development-optimization-terraform/pagerdutyv2.auto.tfvars create mode 100644 software-development-optimization-terraform/pagerdutyv2.tf create mode 100644 software-development-optimization-terraform/pagerdutyv3.auto.tfvars create mode 100644 software-development-optimization-terraform/pagerdutyv3.tf diff --git a/software-development-optimization-terraform/pagerdutyv2.auto.tfvars b/software-development-optimization-terraform/pagerdutyv2.auto.tfvars new file mode 100644 index 00000000..b3cd1a8b --- /dev/null +++ b/software-development-optimization-terraform/pagerdutyv2.auto.tfvars @@ -0,0 +1,8 @@ +# Sumo Logic - SDO Terraform +# Configure Pagerduty credentials and parameters. + +# Please replace (including brackets) with your Pagerduty key, to generate the key, refer: https://support.pagerduty.com/docs/generating-api-keys#section-generating-a-general-access-rest-api-key +pagerduty_api_key = "" +# Please replace and (including > brackets) with your Pagerduty service IDs. You can get these from the URL after opening a specific service. These are used for Pagerduty to Sumo Logic webhooks. +# Examples: ["P6HHD","PHGBUY"] or ["P76GFB"] +pagerduty_services_pagerduty_webhooks = ["",""] \ No newline at end of file diff --git a/software-development-optimization-terraform/pagerdutyv2.tf b/software-development-optimization-terraform/pagerdutyv2.tf new file mode 100644 index 00000000..9c644650 --- /dev/null +++ b/software-development-optimization-terraform/pagerdutyv2.tf @@ -0,0 +1,31 @@ +# Sumo Logic - SDO Terraform + +# This script creates WebhooksV2 to Sumo Logic in Pagerduty Services. +# Configure the Pagerduty credentials in the pagerdutyv2.auto.tfvars. + +data "pagerduty_extension_schema" "webhook" { + count = ("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v2" ? length(var.pagerduty_services_pagerduty_webhooks) : 0 + name = "Generic V2 Webhook" +} + +# Create Webhook in Pagerduty +resource "pagerduty_extension" "sumologic_extension" { + count = length(data.pagerduty_extension_schema.webhook) > 0 && ("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all")? length(var.pagerduty_services_pagerduty_webhooks) : 0 + name = "Sumo Logic Webhook" + endpoint_url = sumologic_http_source.pagerduty[0].url + extension_schema = data.pagerduty_extension_schema.webhook[0].id + extension_objects = [var.pagerduty_services_pagerduty_webhooks[count.index]] +} + +data "pagerduty_vendor" "sumologic" { + count = ("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v2" ? length(var.pagerduty_services_pagerduty_webhooks) : 0 + name = "Sumo Logic" +} + +# We need to create Service Key for each service for Sumo Logic to Pagerduty Webhook +resource "pagerduty_service_integration" "sumologic_v2_service" { + count = length(data.pagerduty_vendor.sumologic) > 0 && "${var.install_sumo_to_pagerduty_webhook}" ? length(var.pagerduty_services_sumo_webhooks) : 0 + name = data.pagerduty_vendor.sumologic[0].name + service = var.pagerduty_services_sumo_webhooks[count.index] + vendor = data.pagerduty_vendor.sumologic[0].id +} \ No newline at end of file diff --git a/software-development-optimization-terraform/pagerdutyv3.auto.tfvars b/software-development-optimization-terraform/pagerdutyv3.auto.tfvars new file mode 100644 index 00000000..3d6535d2 --- /dev/null +++ b/software-development-optimization-terraform/pagerdutyv3.auto.tfvars @@ -0,0 +1,12 @@ +# Sumo Logic - SDO Terraform +# Configure Pagerduty credentials and parameters. + +# Please replace (including brackets) with your Pagerduty key, to generate the key, refer: https://support.pagerduty.com/docs/generating-api-keys#section-generating-a-general-access-rest-api-key +pagerduty_api_key = "" +# Please replace and (including > brackets) with your Pagerduty service IDs. You can get these from the URL after opening a specific service. These are used for Pagerduty to Sumo Logic webhooks. +# Examples: ["P6HHD","PHGBUY"] or ["P76GFB"] +create_services_webhooks = ["",""] +# Please replace blank string with true so as to send Pagerduty account events via the webhook to Sumo. +create_account_webhook = false +# Please replace and (including > brackets) with your Pagerduty team IDs. +create_teams_webhooks = ["",""] \ No newline at end of file diff --git a/software-development-optimization-terraform/pagerdutyv3.tf b/software-development-optimization-terraform/pagerdutyv3.tf new file mode 100644 index 00000000..62b69605 --- /dev/null +++ b/software-development-optimization-terraform/pagerdutyv3.tf @@ -0,0 +1,131 @@ +# Sumo Logic - SDO Terraform + +# This script creates WebhooksV3 to Sumo Logic in Pagerduty Services, Account and Teams. +# Configure the Pagerduty credentials in the pagerdutyv3.auto.tfvars. + +# Create v3 webhook for service/services in PagerDuty +resource "pagerduty_webhook_subscription" "service_webhook" { + count = (("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3") ? length(var.create_services_webhooks) : 0 + delivery_method { + type = "http_delivery_method" + url = sumologic_http_source.pagerduty[0].url + } + description = "Sends PagerDuty v3 webhook events to Sumo" + events = [ + "incident.acknowledged", + "incident.annotated", + "incident.delegated", + "incident.escalated", + "incident.priority_updated", + "incident.reassigned", + "incident.reopened", + "incident.resolved", + "incident.responder.added", + "incident.responder.replied", + "incident.status_update_published", + "incident.triggered", + "incident.unacknowledged", + "service.created", + "service.deleted", + "service.updated" + ] + active = true + filter { + id = "${var.create_services_webhooks[count.index]}" + type = "service_reference" + } + type = "webhook_subscription" +} + +# Send service level alerts to PagerDuty +data "pagerduty_vendor" "v3_service_sumologic" { + count = (("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3") ? length(var.create_services_webhooks) : 0 + name = "Sumo Logic" +} + +# We need to create Service Key for each service for Sumo Logic to Pagerduty Webhook +resource "pagerduty_service_integration" "sumologic_v3_service" { + count = length(data.pagerduty_vendor.v3_service_sumologic) > 0 && "${var.install_sumo_to_pagerduty_webhook}" ? length(var.pagerduty_services_sumo_webhooks) : 0 + name = data.pagerduty_vendor.v3_service_sumologic[0].name + service = var.pagerduty_services_sumo_webhooks[count.index] + vendor = data.pagerduty_vendor.v3_service_sumologic[0].id +} + +# Create v3 webhook for account in PagerDuty +resource "pagerduty_webhook_subscription" "account_webhook" { + count = (("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3") ? ("${var.create_account_webhook}" == true ? 1 : 0) : 0 + delivery_method { + type = "http_delivery_method" + url = sumologic_http_source.pagerduty[0].url + } + description = "Sends PagerDuty v3 webhook events to Sumo" + events = [ + "incident.acknowledged", + "incident.annotated", + "incident.delegated", + "incident.escalated", + "incident.priority_updated", + "incident.reassigned", + "incident.reopened", + "incident.resolved", + "incident.responder.added", + "incident.responder.replied", + "incident.status_update_published", + "incident.triggered", + "incident.unacknowledged", + "service.created", + "service.deleted", + "service.updated" + ] + active = true + filter { + type = "account_reference" + } + type = "webhook_subscription" +} + +# TODO for account level alerts +data "pagerduty_vendor" "v3_account_sumologic" { + count = (("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3" && "${var.create_account_webhook}") == "yes" ? 1 : 0 + name = "Sumo Logic" +} + +# Create v3 webhook for team/teams in PagerDuty +resource "pagerduty_webhook_subscription" "team_webhook" { + count = (("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3") ? length(var.create_teams_webhooks) : 0 + delivery_method { + type = "http_delivery_method" + url = sumologic_http_source.pagerduty[0].url + } + description = "Sends PagerDuty v3 webhook events to Sumo" + events = [ + "incident.acknowledged", + "incident.annotated", + "incident.delegated", + "incident.escalated", + "incident.priority_updated", + "incident.reassigned", + "incident.reopened", + "incident.resolved", + "incident.responder.added", + "incident.responder.replied", + "incident.status_update_published", + "incident.triggered", + "incident.unacknowledged", + "service.created", + "service.deleted", + "service.updated" + ] + active = true + filter { + id = "${var.create_teams_webhooks[count.index]}" + type = "team_reference" + } + type = "webhook_subscription" +} + +# TODO for team level alerts +data "pagerduty_vendor" "v3_team_sumologic" { + count = (("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3") ? length(var.create_teams_webhooks) : 0 + name = "Sumo Logic" +} From aa1852cd06023a8193efb248e913c9ca9b979155 Mon Sep 17 00:00:00 2001 From: Jayanta Kashyap Date: Mon, 21 Mar 2022 21:26:10 +0530 Subject: [PATCH 05/10] updated go files --- software-development-optimization-terraform/test/go.mod | 1 - software-development-optimization-terraform/test/go.sum | 2 -- 2 files changed, 3 deletions(-) diff --git a/software-development-optimization-terraform/test/go.mod b/software-development-optimization-terraform/test/go.mod index 76b56df9..308cb96a 100644 --- a/software-development-optimization-terraform/test/go.mod +++ b/software-development-optimization-terraform/test/go.mod @@ -5,5 +5,4 @@ go 1.14 require ( github.com/gruntwork-io/terratest v0.27.3 github.com/stretchr/testify v1.5.1 - golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect ) diff --git a/software-development-optimization-terraform/test/go.sum b/software-development-optimization-terraform/test/go.sum index f3f306b6..d7f3652d 100644 --- a/software-development-optimization-terraform/test/go.sum +++ b/software-development-optimization-terraform/test/go.sum @@ -422,8 +422,6 @@ golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200107162124-548cf772de50 h1:YvQ10rzcqWXLlJZ3XCUoO25savxmscf4+SC+ZqiCHhA= golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= From 75d302cdb154c38852fb673b2987dd89ae1c6aba Mon Sep 17 00:00:00 2001 From: Jayanta Kashyap Date: Mon, 21 Mar 2022 23:11:20 +0530 Subject: [PATCH 06/10] Revert "updated go files" This reverts commit aa1852cd06023a8193efb248e913c9ca9b979155. --- software-development-optimization-terraform/test/go.mod | 1 + software-development-optimization-terraform/test/go.sum | 2 ++ 2 files changed, 3 insertions(+) diff --git a/software-development-optimization-terraform/test/go.mod b/software-development-optimization-terraform/test/go.mod index 308cb96a..76b56df9 100644 --- a/software-development-optimization-terraform/test/go.mod +++ b/software-development-optimization-terraform/test/go.mod @@ -5,4 +5,5 @@ go 1.14 require ( github.com/gruntwork-io/terratest v0.27.3 github.com/stretchr/testify v1.5.1 + golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect ) diff --git a/software-development-optimization-terraform/test/go.sum b/software-development-optimization-terraform/test/go.sum index d7f3652d..f3f306b6 100644 --- a/software-development-optimization-terraform/test/go.sum +++ b/software-development-optimization-terraform/test/go.sum @@ -422,6 +422,8 @@ golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200107162124-548cf772de50 h1:YvQ10rzcqWXLlJZ3XCUoO25savxmscf4+SC+ZqiCHhA= golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= From c8c188970264f227d31aafebcb6c1b252816944d Mon Sep 17 00:00:00 2001 From: Jayanta Kashyap Date: Tue, 22 Mar 2022 13:09:57 +0530 Subject: [PATCH 07/10] final update --- software-development-optimization-terraform/variables.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/software-development-optimization-terraform/variables.tf b/software-development-optimization-terraform/variables.tf index 9852d98d..3c063fe9 100644 --- a/software-development-optimization-terraform/variables.tf +++ b/software-development-optimization-terraform/variables.tf @@ -148,7 +148,8 @@ variable "install_pagerduty" { variable "install_pagerduty_version"{ type = string - validation { + default = "v3" + validation { condition = contains([ "v2","v3"], var.install_pagerduty_version) error_message = "Argument \"install_pagerduty_version\" must be one of \"v2\" or \"v3\"." From 22315e59fb1b8ec5d0cae712f81529dadea27936 Mon Sep 17 00:00:00 2001 From: Jayanta Kashyap Date: Tue, 22 Mar 2022 17:25:11 +0530 Subject: [PATCH 08/10] formatting update --- .../pagerduty.tf | 2 +- .../pagerdutyv2.auto.tfvars | 4 +- .../pagerdutyv2.tf | 6 +- .../pagerdutyv3.auto.tfvars | 4 +- .../pagerdutyv3.tf | 28 ++--- .../providers.tf | 2 +- .../sumologic_collection_content.tf | 38 +++---- .../sumologic_fer.auto.tfvars | 4 +- .../sumologic_fer.tf | 38 +++---- .../variables.tf | 104 +++++++++--------- .../versions.tf | 24 ++-- 11 files changed, 127 insertions(+), 127 deletions(-) diff --git a/software-development-optimization-terraform/pagerduty.tf b/software-development-optimization-terraform/pagerduty.tf index 42176e58..f9fe696a 100644 --- a/software-development-optimization-terraform/pagerduty.tf +++ b/software-development-optimization-terraform/pagerduty.tf @@ -2,5 +2,5 @@ provider "pagerduty" { skip_credentials_validation = "true" - token = var.pagerduty_api_key + token = var.pagerduty_api_key } diff --git a/software-development-optimization-terraform/pagerdutyv2.auto.tfvars b/software-development-optimization-terraform/pagerdutyv2.auto.tfvars index b3cd1a8b..6edca1ff 100644 --- a/software-development-optimization-terraform/pagerdutyv2.auto.tfvars +++ b/software-development-optimization-terraform/pagerdutyv2.auto.tfvars @@ -2,7 +2,7 @@ # Configure Pagerduty credentials and parameters. # Please replace (including brackets) with your Pagerduty key, to generate the key, refer: https://support.pagerduty.com/docs/generating-api-keys#section-generating-a-general-access-rest-api-key -pagerduty_api_key = "" +pagerduty_api_key = "" # Please replace and (including > brackets) with your Pagerduty service IDs. You can get these from the URL after opening a specific service. These are used for Pagerduty to Sumo Logic webhooks. # Examples: ["P6HHD","PHGBUY"] or ["P76GFB"] -pagerduty_services_pagerduty_webhooks = ["",""] \ No newline at end of file +pagerduty_services_pagerduty_webhooks = ["", ""] \ No newline at end of file diff --git a/software-development-optimization-terraform/pagerdutyv2.tf b/software-development-optimization-terraform/pagerdutyv2.tf index 9c644650..4bb3ca1c 100644 --- a/software-development-optimization-terraform/pagerdutyv2.tf +++ b/software-development-optimization-terraform/pagerdutyv2.tf @@ -5,12 +5,12 @@ data "pagerduty_extension_schema" "webhook" { count = ("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v2" ? length(var.pagerduty_services_pagerduty_webhooks) : 0 - name = "Generic V2 Webhook" + name = "Generic V2 Webhook" } # Create Webhook in Pagerduty resource "pagerduty_extension" "sumologic_extension" { - count = length(data.pagerduty_extension_schema.webhook) > 0 && ("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all")? length(var.pagerduty_services_pagerduty_webhooks) : 0 + count = length(data.pagerduty_extension_schema.webhook) > 0 && ("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") ? length(var.pagerduty_services_pagerduty_webhooks) : 0 name = "Sumo Logic Webhook" endpoint_url = sumologic_http_source.pagerduty[0].url extension_schema = data.pagerduty_extension_schema.webhook[0].id @@ -19,7 +19,7 @@ resource "pagerduty_extension" "sumologic_extension" { data "pagerduty_vendor" "sumologic" { count = ("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v2" ? length(var.pagerduty_services_pagerduty_webhooks) : 0 - name = "Sumo Logic" + name = "Sumo Logic" } # We need to create Service Key for each service for Sumo Logic to Pagerduty Webhook diff --git a/software-development-optimization-terraform/pagerdutyv3.auto.tfvars b/software-development-optimization-terraform/pagerdutyv3.auto.tfvars index 3d6535d2..92ef1467 100644 --- a/software-development-optimization-terraform/pagerdutyv3.auto.tfvars +++ b/software-development-optimization-terraform/pagerdutyv3.auto.tfvars @@ -5,8 +5,8 @@ pagerduty_api_key = "" # Please replace and (including > brackets) with your Pagerduty service IDs. You can get these from the URL after opening a specific service. These are used for Pagerduty to Sumo Logic webhooks. # Examples: ["P6HHD","PHGBUY"] or ["P76GFB"] -create_services_webhooks = ["",""] +create_services_webhooks = ["", ""] # Please replace blank string with true so as to send Pagerduty account events via the webhook to Sumo. create_account_webhook = false # Please replace and (including > brackets) with your Pagerduty team IDs. -create_teams_webhooks = ["",""] \ No newline at end of file +create_teams_webhooks = ["", ""] \ No newline at end of file diff --git a/software-development-optimization-terraform/pagerdutyv3.tf b/software-development-optimization-terraform/pagerdutyv3.tf index 62b69605..eca2645c 100644 --- a/software-development-optimization-terraform/pagerdutyv3.tf +++ b/software-development-optimization-terraform/pagerdutyv3.tf @@ -8,7 +8,7 @@ resource "pagerduty_webhook_subscription" "service_webhook" { count = (("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3") ? length(var.create_services_webhooks) : 0 delivery_method { type = "http_delivery_method" - url = sumologic_http_source.pagerduty[0].url + url = sumologic_http_source.pagerduty[0].url } description = "Sends PagerDuty v3 webhook events to Sumo" events = [ @@ -31,7 +31,7 @@ resource "pagerduty_webhook_subscription" "service_webhook" { ] active = true filter { - id = "${var.create_services_webhooks[count.index]}" + id = var.create_services_webhooks[count.index] type = "service_reference" } type = "webhook_subscription" @@ -40,7 +40,7 @@ resource "pagerduty_webhook_subscription" "service_webhook" { # Send service level alerts to PagerDuty data "pagerduty_vendor" "v3_service_sumologic" { count = (("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3") ? length(var.create_services_webhooks) : 0 - name = "Sumo Logic" + name = "Sumo Logic" } # We need to create Service Key for each service for Sumo Logic to Pagerduty Webhook @@ -56,7 +56,7 @@ resource "pagerduty_webhook_subscription" "account_webhook" { count = (("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3") ? ("${var.create_account_webhook}" == true ? 1 : 0) : 0 delivery_method { type = "http_delivery_method" - url = sumologic_http_source.pagerduty[0].url + url = sumologic_http_source.pagerduty[0].url } description = "Sends PagerDuty v3 webhook events to Sumo" events = [ @@ -85,17 +85,17 @@ resource "pagerduty_webhook_subscription" "account_webhook" { } # TODO for account level alerts -data "pagerduty_vendor" "v3_account_sumologic" { - count = (("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3" && "${var.create_account_webhook}") == "yes" ? 1 : 0 - name = "Sumo Logic" -} +# data "pagerduty_vendor" "v3_account_sumologic" { +# count = (("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3" && "${var.create_account_webhook}") == "yes" ? 1 : 0 +# name = "Sumo Logic" +# } # Create v3 webhook for team/teams in PagerDuty resource "pagerduty_webhook_subscription" "team_webhook" { count = (("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3") ? length(var.create_teams_webhooks) : 0 delivery_method { type = "http_delivery_method" - url = sumologic_http_source.pagerduty[0].url + url = sumologic_http_source.pagerduty[0].url } description = "Sends PagerDuty v3 webhook events to Sumo" events = [ @@ -118,14 +118,14 @@ resource "pagerduty_webhook_subscription" "team_webhook" { ] active = true filter { - id = "${var.create_teams_webhooks[count.index]}" + id = var.create_teams_webhooks[count.index] type = "team_reference" } type = "webhook_subscription" } # TODO for team level alerts -data "pagerduty_vendor" "v3_team_sumologic" { - count = (("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3") ? length(var.create_teams_webhooks) : 0 - name = "Sumo Logic" -} +# data "pagerduty_vendor" "v3_team_sumologic" { +# count = (("${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3") ? length(var.create_teams_webhooks) : 0 +# name = "Sumo Logic" +# } diff --git a/software-development-optimization-terraform/providers.tf b/software-development-optimization-terraform/providers.tf index a0428fcc..5bf08ae9 100644 --- a/software-development-optimization-terraform/providers.tf +++ b/software-development-optimization-terraform/providers.tf @@ -8,6 +8,6 @@ terraform { github = "~> 2.8" pagerduty = "~> 2.3" sumologic = "~> 2.1.0" - gitlab ="3.6.0" + gitlab = "3.6.0" } } \ No newline at end of file diff --git a/software-development-optimization-terraform/sumologic_collection_content.tf b/software-development-optimization-terraform/sumologic_collection_content.tf index c1e58537..fb23de4e 100644 --- a/software-development-optimization-terraform/sumologic_collection_content.tf +++ b/software-development-optimization-terraform/sumologic_collection_content.tf @@ -132,7 +132,7 @@ locals { resource "null_resource" "create_folder" { depends_on = [sumologic_collector.sdo_collector] triggers = { - version = var.folder_version + version = var.folder_version } provisioner "local-exec" { command = <.+)\\/.+\" \n| project_name as service\n| substring(issue_type,1,length(issue_type)-1) as issue_type\n|if (issue_type matches \"*incident*\",\"incident\",\"issue\") as issue_type\n| parseDate(datetime, \"yyyy-MM-dd HH:mm:ss\",\"etc/utc\") as datetime_epoch\n| if (isNull(closeddate) , 00000000000, parseDate(closedDate, \"yyyy-MM-dd HH:mm:ss\",\"etc/utc\")) as closeddate_epoch\n| if(issue_status matches \"opened\",\"To Do\",if(issue_status matches \"closed\",\"Complete\",issue_status)) as issue_status\n| toLong(datetime_epoch) as datetime_epoch\n| toLong(closeddate_epoch) as closeddate_epoch\n| \"issue\" as event_type\n" -gitlab_push_fer_scope = " %\"x-gitlab-event\" = \"Push Hook\"" +gitlab_push_fer_scope = " %\"x-gitlab-event\" = \"Push Hook\"" gitlab_push_fer_parse = "json \"commits[(@.length-2)].id\" as head_commit_id\n| json \"commits[(@.length-2)].timestamp\" as head_commit_datetime\n| json \"commits[(@.length-2)].message\" as head_commit_message\n| parseDate(head_commit_datetime, \"yyyy-MM-dd'T'HH:mm:ssXXX\",\"etc/utc\") as head_commit_epoch\n| json \"commits[0].id\" as base_commit_id\n| json \"commits[0].timestamp\" as base_commit_datetime\n| json \"commits[0].message\" as base_commit_message\n| parseDate(base_commit_datetime, \"yyyy-MM-dd'T'HH:mm:ssXXX\",\"etc/utc\") as base_commit_epoch\n| json \"repository.name\",\"user_name\" as repository_name,user\n| \"push\" as event_type\n" circleci_build_fer_scope = "circleci/job-collector\n" circleci_build_fer_parse = "json \"workflows.job_name\" as job_type\n|where toLowerCase(job_type) matches \"BUILDJOBNAME\" \n|json \"custom_data.env\",\"custom_data.team\",\"custom_data.service\",\"workflows.job_id\",\"user.login\",\"build_url\",\"start_time\",\"branch\",\"outcome\",\"reponame\",\"vcs_revision\",\"job_name\",\"build_num\",\"messages\" as environment_name,team,service,trace_id,user,link,datetime,target_branch,job_status,repository_name,commit_id,job_name,build_number,message nodrop\n| if(job_status == \"success\", \"Success\", \"Failed\") as status\n| toLong(parseDate(datetime, \"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")) as datetime_epoch\n| concat(job_type, \" # \",build_number) as title\n|\"build\" as event_type" circleci_deploy_fer_scope = "circleci/job-collector\n" -circleci_deploy_fer_parse = "json \"workflows.job_name\" as job_type\n|where toLowerCase(job_type) matches (\"DEPLOYJOBNAME\")\n|json \"custom_data.env\",\"custom_data.team\",\"custom_data.service\",\"workflows.job_id\",\"user.login\",\"build_url\",\"start_time\",\"branch\",\"outcome\",\"reponame\",\"vcs_revision\",\"job_name\",\"messages\",\"build_num\" as environment_name,team,service,trace_id,user,link,datetime,target_branch,job_status,repository_name,commit_id,job_name,message,job_num nodrop\n| if(job_status == \"success\", \"Success\", \"Failed\") as status\n| toLong(parseDate(datetime, \"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\",\"etc/utc\")) as datetime_epoch\n| concat(job_type, \" # \",job_num) as title\n|\"deploy\" as event_type\n" +circleci_deploy_fer_parse = "json \"workflows.job_name\" as job_type\n|where toLowerCase(job_type) matches (\"DEPLOYJOBNAME\")\n|json \"custom_data.env\",\"custom_data.team\",\"custom_data.service\",\"workflows.job_id\",\"user.login\",\"build_url\",\"start_time\",\"branch\",\"outcome\",\"reponame\",\"vcs_revision\",\"job_name\",\"messages\",\"build_num\" as environment_name,team,service,trace_id,user,link,datetime,target_branch,job_status,repository_name,commit_id,job_name,message,job_num nodrop\n| if(job_status == \"success\", \"Success\", \"Failed\") as status\n| toLong(parseDate(datetime, \"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\",\"etc/utc\")) as datetime_epoch\n| concat(job_type, \" # \",job_num) as title\n|\"deploy\" as event_type\n" diff --git a/software-development-optimization-terraform/sumologic_fer.tf b/software-development-optimization-terraform/sumologic_fer.tf index b6c24dd4..94836d56 100644 --- a/software-development-optimization-terraform/sumologic_fer.tf +++ b/software-development-optimization-terraform/sumologic_fer.tf @@ -2,7 +2,7 @@ resource "sumologic_field_extraction_rule" "github_pr_fer" { count = "${var.install_github}" == "fer" || "${var.install_github}" == "collection" || "${var.install_github}" == "all" ? 1 : 0 - depends_on = [sumologic_http_source.github,restapi_object.github_field] + depends_on = [sumologic_http_source.github, restapi_object.github_field] name = "SDO - Github Pull Request" scope = "_sourceCategory=${var.github_sc} ${var.github_pull_request_fer_scope}" parse_expression = var.github_pull_request_fer_parse @@ -11,7 +11,7 @@ resource "sumologic_field_extraction_rule" "github_pr_fer" { resource "sumologic_field_extraction_rule" "github_push_fer" { count = "${var.install_github}" == "fer" || "${var.install_github}" == "collection" || "${var.install_github}" == "all" ? 1 : 0 - depends_on = [sumologic_http_source.github,restapi_object.github_field] + depends_on = [sumologic_http_source.github, restapi_object.github_field] name = "SDO - Github Push" scope = "_sourceCategory=${var.github_sc} ${var.github_push_fer_scope}" parse_expression = var.github_push_fer_parse @@ -55,7 +55,7 @@ resource "sumologic_field_extraction_rule" "opsgenie_alerts_fer" { resource "sumologic_field_extraction_rule" "bitbucket_pr_fer" { count = "${var.install_bitbucket_cloud}" == "fer" || "${var.install_bitbucket_cloud}" == "collection" || "${var.install_bitbucket_cloud}" == "all" ? 1 : 0 - depends_on = [sumologic_http_source.bitbucket_cloud,restapi_object.bitbucket_field] + depends_on = [sumologic_http_source.bitbucket_cloud, restapi_object.bitbucket_field] name = "SDO - Bitbucket Pull Request" scope = "_sourceCategory=${var.bitbucket_sc} ${var.bitbucket_pull_request_fer_scope}" parse_expression = var.bitbucket_pull_request_fer_parse @@ -64,7 +64,7 @@ resource "sumologic_field_extraction_rule" "bitbucket_pr_fer" { resource "sumologic_field_extraction_rule" "bitbucket_build_fer" { count = "${var.install_bitbucket_cloud}" == "fer" || "${var.install_bitbucket_cloud}" == "collection" || "${var.install_bitbucket_cloud}" == "all" ? 1 : 0 - depends_on = [sumologic_http_source.bitbucket_cloud,restapi_object.bitbucket_field] + depends_on = [sumologic_http_source.bitbucket_cloud, restapi_object.bitbucket_field] name = "SDO - Bitbucket Build" scope = "_sourceCategory=${var.bitbucket_sc} ${var.bitbucket_build_fer_scope}" parse_expression = var.bitbucket_build_fer_parse @@ -73,7 +73,7 @@ resource "sumologic_field_extraction_rule" "bitbucket_build_fer" { resource "sumologic_field_extraction_rule" "bitbucket_deploy_fer" { count = "${var.install_bitbucket_cloud}" == "fer" || "${var.install_bitbucket_cloud}" == "collection" || "${var.install_bitbucket_cloud}" == "all" ? 1 : 0 - depends_on = [sumologic_http_source.bitbucket_cloud,restapi_object.bitbucket_field] + depends_on = [sumologic_http_source.bitbucket_cloud, restapi_object.bitbucket_field] name = "SDO - Bitbucket Deploy" scope = "_sourceCategory=${var.bitbucket_sc} ${var.bitbucket_deploy_fer_scope}" parse_expression = var.bitbucket_deploy_fer_parse @@ -82,7 +82,7 @@ resource "sumologic_field_extraction_rule" "bitbucket_deploy_fer" { resource "sumologic_field_extraction_rule" "bitbucket_push_fer" { count = "${var.install_bitbucket_cloud}" == "fer" || "${var.install_bitbucket_cloud}" == "collection" || "${var.install_bitbucket_cloud}" == "all" ? 1 : 0 - depends_on = [sumologic_http_source.bitbucket_cloud,restapi_object.bitbucket_field] + depends_on = [sumologic_http_source.bitbucket_cloud, restapi_object.bitbucket_field] name = "SDO - Bitbucket Push" scope = "_sourceCategory=${var.bitbucket_sc} ${var.bitbucket_push_fer_scope}" parse_expression = var.bitbucket_push_fer_parse @@ -98,7 +98,7 @@ resource "sumologic_field_extraction_rule" "jira_issues_fer" { } resource "sumologic_field_extraction_rule" "pagerduty_alerts_v2_fer" { - count = ("${var.install_pagerduty}" == "fer" || "${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v2" ? 1 : 0 + count = ("${var.install_pagerduty}" == "fer" || "${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v2" ? 1 : 0 depends_on = [sumologic_http_source.pagerduty] name = "SDO - Pagerduty V2 Alerts" scope = "_sourceCategory=${var.pagerduty_sc} ${var.pagerduty_alerts_v2_fer_scope}" @@ -107,7 +107,7 @@ resource "sumologic_field_extraction_rule" "pagerduty_alerts_v2_fer" { } resource "sumologic_field_extraction_rule" "pagerduty_alerts_v3_fer" { - count = ("${var.install_pagerduty}" == "fer" || "${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3" ? 1 : 0 + count = ("${var.install_pagerduty}" == "fer" || "${var.install_pagerduty}" == "collection" || "${var.install_pagerduty}" == "all") && "${var.install_pagerduty_version}" == "v3" ? 1 : 0 depends_on = [sumologic_http_source.pagerduty] name = "SDO - Pagerduty V3 Alerts" scope = "_sourceCategory=${var.pagerduty_sc} ${var.pagerduty_alerts_v3_fer_scope}" @@ -117,7 +117,7 @@ resource "sumologic_field_extraction_rule" "pagerduty_alerts_v3_fer" { resource "sumologic_field_extraction_rule" "gitlab_pr_fer" { count = "${var.install_gitlab}" == "fer" || "${var.install_gitlab}" == "collection" || "${var.install_gitlab}" == "all" ? 1 : 0 - depends_on = [sumologic_http_source.gitlab,restapi_object.gitlab_field] + depends_on = [sumologic_http_source.gitlab, restapi_object.gitlab_field] name = "SDO - Gitlab Pull Request" scope = "_sourceCategory=${var.gitlab_sc} ${var.gitlab_pull_request_fer_scope}" parse_expression = var.gitlab_pull_request_fer_parse @@ -125,18 +125,18 @@ resource "sumologic_field_extraction_rule" "gitlab_pr_fer" { } resource "sumologic_field_extraction_rule" "gitlab_build_fer" { - count = "${var.install_gitlab}" == "fer" || "${var.install_gitlab}" == "collection" || "${var.install_gitlab}" == "all" ? 1 : 0 - depends_on = [sumologic_http_source.gitlab,restapi_object.gitlab_field] - name = "SDO - Gitlab Build" - scope = "_sourceCategory=${var.gitlab_sc} ${var.gitlab_build_request_fer_scope}" + count = "${var.install_gitlab}" == "fer" || "${var.install_gitlab}" == "collection" || "${var.install_gitlab}" == "all" ? 1 : 0 + depends_on = [sumologic_http_source.gitlab, restapi_object.gitlab_field] + name = "SDO - Gitlab Build" + scope = "_sourceCategory=${var.gitlab_sc} ${var.gitlab_build_request_fer_scope}" #parse_expression = var.gitlab_build_request_fer_parse - parse_expression = replace(var.gitlab_build_request_fer_parse,"Gitlab_Build_Job_Name",var.gitlab_build_jobname) + parse_expression = replace(var.gitlab_build_request_fer_parse, "Gitlab_Build_Job_Name", var.gitlab_build_jobname) enabled = true } resource "sumologic_field_extraction_rule" "gitlab_deploy_fer" { count = "${var.install_gitlab}" == "fer" || "${var.install_gitlab}" == "collection" || "${var.install_gitlab}" == "all" ? 1 : 0 - depends_on = [sumologic_http_source.gitlab,restapi_object.gitlab_field] + depends_on = [sumologic_http_source.gitlab, restapi_object.gitlab_field] name = "SDO - Gitlab Deploy" scope = "_sourceCategory=${var.gitlab_sc} ${var.gitlab_deploy_request_fer_scope}" parse_expression = var.gitlab_deploy_request_fer_parse @@ -145,7 +145,7 @@ resource "sumologic_field_extraction_rule" "gitlab_deploy_fer" { resource "sumologic_field_extraction_rule" "gitlab_issue_fer" { count = "${var.install_gitlab}" == "fer" || "${var.install_gitlab}" == "collection" || "${var.install_gitlab}" == "all" ? 1 : 0 - depends_on = [sumologic_http_source.gitlab,restapi_object.gitlab_field] + depends_on = [sumologic_http_source.gitlab, restapi_object.gitlab_field] name = "SDO - Gitlab Issue" scope = "_sourceCategory=${var.gitlab_sc} ${var.gitlab_issue_request_fer_scope}" parse_expression = var.gitlab_issue_request_fer_parse @@ -154,7 +154,7 @@ resource "sumologic_field_extraction_rule" "gitlab_issue_fer" { resource "sumologic_field_extraction_rule" "gitlab_push_fer" { count = "${var.install_gitlab}" == "fer" || "${var.install_gitlab}" == "collection" || "${var.install_gitlab}" == "all" ? 1 : 0 - depends_on = [sumologic_http_source.gitlab,restapi_object.gitlab_field] + depends_on = [sumologic_http_source.gitlab, restapi_object.gitlab_field] name = "SDO - Gitlab Push" scope = "_sourceCategory=${var.gitlab_sc} ${var.gitlab_push_fer_scope}" parse_expression = var.gitlab_push_fer_parse @@ -166,7 +166,7 @@ resource "sumologic_field_extraction_rule" "circleci_orb_build_fer" { depends_on = [sumologic_http_source.circleci_orb_job] name = "SDO - CircleCi Build " scope = "_sourceCategory=${var.circleci_build_fer_scope}" - parse_expression = replace(var.circleci_build_fer_parse,"BUILDJOBNAME",var.circleci_build_jobname) + parse_expression = replace(var.circleci_build_fer_parse, "BUILDJOBNAME", var.circleci_build_jobname) enabled = true } @@ -175,6 +175,6 @@ resource "sumologic_field_extraction_rule" "circleci_orb_deploy_fer" { depends_on = [sumologic_http_source.circleci_orb_job] name = "SDO - CircleCi Deploy " scope = "_sourceCategory=${var.circleci_deploy_fer_scope}" - parse_expression = replace(var.circleci_deploy_fer_parse,"DEPLOYJOBNAME",var.circleci_deploy_jobname) + parse_expression = replace(var.circleci_deploy_fer_parse, "DEPLOYJOBNAME", var.circleci_deploy_jobname) enabled = true } \ No newline at end of file diff --git a/software-development-optimization-terraform/variables.tf b/software-development-optimization-terraform/variables.tf index 3c063fe9..ec128942 100644 --- a/software-development-optimization-terraform/variables.tf +++ b/software-development-optimization-terraform/variables.tf @@ -26,159 +26,159 @@ variable "deployment" { validation { condition = contains([ "US1", - "us1","US2","us2","AU","au","CA","ca","DE","de","EU","eu","FED","fed","JP","jp","IN","in"], var.deployment) + "us1", "US2", "us2", "AU", "au", "CA", "ca", "DE", "de", "EU", "eu", "FED", "fed", "JP", "jp", "IN", "in"], var.deployment) error_message = "Argument \"deployment\" must be one of \"us1\",\"us2\",\"au\",\"ca\",\"de\",\"eu\",\"fed\",\"jp\",\"in\"." } } variable "sumo_api_endpoint" { - type = string + type = string validation { - condition = contains([ - "https://api.au.sumologic.com/api/", - "https://api.ca.sumologic.com/api/","https://api.de.sumologic.com/api/","https://api.eu.sumologic.com/api/","https://api.fed.sumologic.com/api/","https://api.in.sumologic.com/api/","https://api.jp.sumologic.com/api/","https://api.sumologic.com/api/","https://api.us2.sumologic.com/api/"], var.sumo_api_endpoint) - error_message = "Argument \"sumo_api_endpoint\" must be one of the values specified at https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security." -} + condition = contains([ + "https://api.au.sumologic.com/api/", + "https://api.ca.sumologic.com/api/", "https://api.de.sumologic.com/api/", "https://api.eu.sumologic.com/api/", "https://api.fed.sumologic.com/api/", "https://api.in.sumologic.com/api/", "https://api.jp.sumologic.com/api/", "https://api.sumologic.com/api/", "https://api.us2.sumologic.com/api/"], var.sumo_api_endpoint) + error_message = "Argument \"sumo_api_endpoint\" must be one of the values specified at https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security." + } } variable "app_installation_folder" { - default = "Software Development Optimization" + default = "SDO PagerDuty Test" } variable "collector_name" { - default = "Software Development Optimization" + default = "SDO PagerDuty Test" } #Apps variable "install_jira_cloud" { - type = string + type = string validation { condition = contains([ - "all","none","fer","app","collection"], var.install_jira_cloud) + "all", "none", "fer", "app", "collection"], var.install_jira_cloud) error_message = "Argument \"install_jira_cloud\" must be one of \"all\",\"none\",\"fer\",\"app\",\"collection\"." } } variable "install_bitbucket_cloud" { - type = string + type = string validation { condition = contains([ - "all","none","fer","app","collection"], var.install_bitbucket_cloud) + "all", "none", "fer", "app", "collection"], var.install_bitbucket_cloud) error_message = "Argument \"install_bitbucket_cloud\" must be one of \"all\",\"none\",\"fer\",\"app\",\"collection\"." } } variable "install_opsgenie" { - type = string + type = string validation { condition = contains([ - "all","none","fer","app","collection"], var.install_opsgenie) + "all", "none", "fer", "app", "collection"], var.install_opsgenie) error_message = "Argument \"install_opsgenie\" must be one of \"all\",\"none\",\"fer\",\"app\",\"collection\"." } } variable "install_sumo_to_opsgenie_webhook" { - type = string + type = string validation { condition = contains([ - "true","false"], var.install_sumo_to_opsgenie_webhook) + "true", "false"], var.install_sumo_to_opsgenie_webhook) error_message = "Argument \"install_sumo_to_opsgenie_webhook\" must be one of \"true\",\"false\"." } } variable "install_jira_server" { - type = string + type = string validation { condition = contains([ - "all","none","fer","app","collection"], var.install_jira_server) + "all", "none", "fer", "app", "collection"], var.install_jira_server) error_message = "Argument \"install_jira_server\" must be one of \"all\",\"none\",\"fer\",\"app\",\"collection\"." } } variable "install_sumo_to_jiracloud_webhook" { - type = string + type = string validation { condition = contains([ - "true","false"], var.install_sumo_to_jiracloud_webhook) + "true", "false"], var.install_sumo_to_jiracloud_webhook) error_message = "Argument \"install_sumo_to_jiracloud_webhook\" must be one of \"true\",\"false\"." } } variable "install_sumo_to_jiraserver_webhook" { - type = string + type = string validation { condition = contains([ - "true","false"], var.install_sumo_to_jiraserver_webhook) + "true", "false"], var.install_sumo_to_jiraserver_webhook) error_message = "Argument \"install_sumo_to_jiraserver_webhook\" must be one of \"true\",\"false\"." } } variable "install_sumo_to_jiraservicedesk_webhook" { - type = string + type = string validation { condition = contains([ - "true","false"], var.install_sumo_to_jiraservicedesk_webhook) + "true", "false"], var.install_sumo_to_jiraservicedesk_webhook) error_message = "Argument \"install_sumo_to_jiraservicedesk_webhook\" must be one of \"true\",\"false\"." } } variable "install_jenkins" { - type = string + type = string validation { condition = contains([ - "all","none","fer","app","collection"], var.install_jenkins) + "all", "none", "fer", "app", "collection"], var.install_jenkins) error_message = "Argument \"install_jenkins\" must be one of \"all\",\"none\",\"fer\",\"app\",\"collection\"." } } variable "install_github" { - type = string + type = string validation { condition = contains([ - "all","none","fer","app","collection"], var.install_github) + "all", "none", "fer", "app", "collection"], var.install_github) error_message = "Argument \"install_github\" must be one of \"all\",\"none\",\"fer\",\"app\",\"collection\"." } } variable "install_gitlab" { - type = string + type = string validation { condition = contains([ - "all","none","fer","app","collection"], var.install_gitlab) + "all", "none", "fer", "app", "collection"], var.install_gitlab) error_message = "Argument \"install_gitlab\" must be one of \"all\",\"none\",\"fer\",\"app\",\"collection\"." } } variable "install_pagerduty" { - type = string + type = string validation { condition = contains([ - "all","none","fer","app","collection"], var.install_pagerduty) + "all", "none", "fer", "app", "collection"], var.install_pagerduty) error_message = "Argument \"install_pagerduty\" must be one of \"all\",\"none\",\"fer\",\"app\",\"collection\"." } } -variable "install_pagerduty_version"{ - type = string - default = "v3" - validation { +variable "install_pagerduty_version" { + type = string + default = "v3" + validation { condition = contains([ - "v2","v3"], var.install_pagerduty_version) + "v2", "v3"], var.install_pagerduty_version) error_message = "Argument \"install_pagerduty_version\" must be one of \"v2\" or \"v3\"." } } variable "install_sdo" { - type = string + type = string validation { condition = contains([ - "none","app"], var.install_sdo) + "none", "app"], var.install_sdo) error_message = "Argument \"install_sdo\" must be one of \"none\",\"app\"." } } variable "install_circleci" { - type = string + type = string validation { condition = contains([ - "all","none","app","collection"], var.install_circleci) + "all", "none", "app", "collection"], var.install_circleci) error_message = "Argument \"install_circleci\" must be one of \"none\",\"app\",\"all\" and \"collection\"." } } variable "install_circleci_SDO_plugin" { - type = string + type = string validation { condition = contains([ - "all","none","fer","collection"], var.install_circleci_SDO_plugin) + "all", "none", "fer", "collection"], var.install_circleci_SDO_plugin) error_message = "Argument \"install_circleci_SDO_plugin\" must be one of \"all\",\"none\",\"fer\",\"collection\"." } } @@ -260,10 +260,10 @@ variable "pagerduty_api_key" {} variable "pagerduty_services_pagerduty_webhooks" {} variable "pagerduty_services_sumo_webhooks" {} variable "install_sumo_to_pagerduty_webhook" { - type = string + type = string validation { condition = contains([ - "true","false"], var.install_sumo_to_pagerduty_webhook) + "true", "false"], var.install_sumo_to_pagerduty_webhook) error_message = "Argument \"install_sumo_to_pagerduty_webhook\" must be one of \"true\",\"false\"." } } @@ -279,18 +279,18 @@ variable "github_repository_names" {} variable "github_repo_events" {} variable "github_org_events" {} variable "github_org_webhook_create" { - type = string + type = string validation { condition = contains([ - "true","false"], var.github_org_webhook_create) + "true", "false"], var.github_org_webhook_create) error_message = "Argument \"github_org_webhook_create\" must be one of \"true\",\"false\"." } } variable "github_repo_webhook_create" { - type = string + type = string validation { condition = contains([ - "true","false"], var.github_repo_webhook_create) + "true", "false"], var.github_repo_webhook_create) error_message = "Argument \"github_repo_webhook_create\" must be one of \"true\",\"false\"." } } @@ -319,10 +319,10 @@ variable "circleci_deploy_jobname" { variable "gitlab_token" {} variable "gitlab_project_names" {} variable "gitlab_project_webhook_create" { - type = string + type = string validation { condition = contains([ - "true","false"], var.gitlab_project_webhook_create) + "true", "false"], var.gitlab_project_webhook_create) error_message = "Argument \"gitlab_project_webhook_create\" must be one of \"true\",\"false\"." } } diff --git a/software-development-optimization-terraform/versions.tf b/software-development-optimization-terraform/versions.tf index 9cd99dd2..4b25a13d 100644 --- a/software-development-optimization-terraform/versions.tf +++ b/software-development-optimization-terraform/versions.tf @@ -2,41 +2,41 @@ # Increment for each app update. variable "folder_version" { - default = "1" + default = "1" } variable "jira_cloud_version" { - default = "1" + default = "1" } variable "jira_server_version" { - default = "1" + default = "1" } variable "bitbucket_version" { - default = "1" + default = "1" } variable "opsgenie_version" { - default = "1" + default = "1" } variable "pagerduty_v2_version" { - default = "2" + default = "2" } variable "pagerduty_v3_version" { - default = "1" + default = "1" } variable "github_version" { - default = "2" + default = "2" } variable "gitlab_version" { - default = "1" + default = "1" } variable "jenkins_version" { - default = "1" + default = "1" } variable "sdo_version" { - default = "2" + default = "2" } variable "circleci_version" { - default = "1" + default = "1" } \ No newline at end of file From 42c91903033139be54eb50a61d564cb4c98cd12d Mon Sep 17 00:00:00 2001 From: Jayanta Kashyap Date: Tue, 22 Mar 2022 17:31:42 +0530 Subject: [PATCH 09/10] Revert "final update" This reverts commit c8c188970264f227d31aafebcb6c1b252816944d. --- software-development-optimization-terraform/variables.tf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/software-development-optimization-terraform/variables.tf b/software-development-optimization-terraform/variables.tf index ec128942..e158b02b 100644 --- a/software-development-optimization-terraform/variables.tf +++ b/software-development-optimization-terraform/variables.tf @@ -146,9 +146,14 @@ variable "install_pagerduty" { } } +<<<<<<< HEAD variable "install_pagerduty_version" { type = string - default = "v3" + +======= +variable "install_pagerduty_version"{ + type = string +>>>>>>> parent of c8c1889 (final update) validation { condition = contains([ "v2", "v3"], var.install_pagerduty_version) From 835920bf739d472e5af2ca44950e80b6fdb6734e Mon Sep 17 00:00:00 2001 From: Jayanta Kashyap Date: Tue, 22 Mar 2022 17:37:43 +0530 Subject: [PATCH 10/10] updated variables --- .../variables.tf | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/software-development-optimization-terraform/variables.tf b/software-development-optimization-terraform/variables.tf index e158b02b..3c79babf 100644 --- a/software-development-optimization-terraform/variables.tf +++ b/software-development-optimization-terraform/variables.tf @@ -40,10 +40,10 @@ variable "sumo_api_endpoint" { } } variable "app_installation_folder" { - default = "SDO PagerDuty Test" + default = "Software Development Optimization" } variable "collector_name" { - default = "SDO PagerDuty Test" + default = "Software Development Optimization" } #Apps @@ -146,14 +146,9 @@ variable "install_pagerduty" { } } -<<<<<<< HEAD variable "install_pagerduty_version" { type = string - -======= -variable "install_pagerduty_version"{ - type = string ->>>>>>> parent of c8c1889 (final update) + default = "v3" validation { condition = contains([ "v2", "v3"], var.install_pagerduty_version)