Skip to content

Commit 225ff3b

Browse files
committed
Initial Commit
1 parent 2af25c1 commit 225ff3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1304
-0
lines changed

README.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# terraform-sumologic-integrations
2+
3+
Configure Sumo Logic Applications using Terraform modules.
4+
5+
## Getting Started
6+
7+
#### Requirements
8+
9+
* [Terraform 0.12.26+](https://www.terraform.io/downloads.html)
10+
* [curl](https://curl.haxx.se/download.html) for App installations.
11+
12+
#### Sumo Logic Provider
13+
14+
```shell
15+
provider "sumologic" {
16+
access_id = "<SUMOLOGIC ACCESS ID>"
17+
access_key = "<SUMOLOGIC ACCESS KEY>"
18+
environment = "<SUMOLOGIC DEPLOYMENT>"
19+
}
20+
```
21+
You can also define these values in `terraform.tfvars`.
22+
23+
#### REST Api Provider
24+
25+
Two REST API provider configurations are required by these modules:
26+
27+
1. Sumo Logic REST Api provider configuration is required for App installations and is needed for all integrations involving App configuration and installation:
28+
29+
```shell
30+
provider "restapi" {
31+
alias = "sumo"
32+
uri = "<SUMOLOGIC ENDPOINT URI>"
33+
write_returns_object = true
34+
username = "<SUMOLOGIC ACCESS ID>"
35+
password = "<SUMOLOGIC ACCESS KEY>"
36+
headers = { Content-Type = "application/json" }
37+
}
38+
```
39+
You can also define these values in `terraform.tfvars`.
40+
41+
2. Opsgenie REST Api provider configuration is required for configuring webhooks in Opsgenie and is needed for Opsgenie integration configuration:
42+
43+
```shell
44+
provider "restapi" {
45+
alias = "opsgenie"
46+
uri = "https://api.opsgenie.com"
47+
write_returns_object = true
48+
headers = { Content-Type = "application/json", Authorization = "GenieKey <OPSGENIE KEY>" }
49+
}
50+
```
51+
You can also define these values in `terraform.tfvars`.
52+
53+
#### Prerequisites for using Modules
54+
55+
All App integrations needs a collector and a folder where the App should be installed.
56+
Sumo Logic Webhooks do not need a collector or folder.
57+
58+
Configure the collector resource as below:
59+
60+
```shell
61+
resource "sumologic_collector" "atlassian_collector" {
62+
name = "Atlassian"
63+
category = "Atlassian"
64+
}
65+
```
66+
67+
In the module declaration, pass the collector id as `sumologic_collector.atlassian_collector.id`.
68+
69+
Configure a folder as below:
70+
71+
```shell
72+
data "sumologic_personal_folder" "personalFolder" {}
73+
resource "sumologic_folder" "folder" {
74+
name = "Atlassian"
75+
description = "Atlassian Applications"
76+
parent_id = data.sumologic_personal_folder.personalFolder.id
77+
depends_on = [sumologic_collector.atlassian_collector]
78+
}
79+
```
80+
81+
In the module declaration, pass the folder id as `sumologic_folder.folder.id`.
82+
83+
#### Module Declaration
84+
85+
##### Opsgenie
86+
87+
```shell
88+
module "sumologic-jira-opsgenie-app" {
89+
source = "github.com/SumoLogic/sumologic-terraform-integrations//atlassian/cloud/opsgenie"
90+
providers = {
91+
restapi = restapi.opsgenie
92+
}
93+
sumo_access_id = "<SUMOLOGIC ACCESS ID>"
94+
sumo_access_key = "<SUMOLOGIC ACCESS KEY>"
95+
sumo_api_endpoint = "<SUMOLOGIC ENDPOINT URI>"
96+
collector_id = sumologic_collector.atlassian_collector.id
97+
source_category = "Atlassian/Opsgenie"
98+
folder_id = sumologic_folder.folder.id
99+
# version = "{revision}"
100+
}
101+
```
102+
103+
##### Jira Cloud
104+
105+
```shell
106+
module "sumologic-jira-cloud-app" {
107+
source = "github.com/SumoLogic/sumologic-terraform-integrations//atlassian/cloud/jira"
108+
sumo_access_id = "<SUMOLOGIC ACCESS ID>"
109+
sumo_access_key = "<SUMOLOGIC ACCESS KEY>"
110+
sumo_api_endpoint = "<SUMOLOGIC ENDPOINT URI>"
111+
collector_id = sumologic_collector.atlassian_collector.id
112+
source_category = "Atlassian/Cloud/Jira"
113+
folder_id = sumologic_folder.folder.id
114+
jira_cloud_jql = "" # Optional
115+
jira_cloud_events = ["jira:issue_created", "jira:issue_updated"] # Optional. By default all events are configured.
116+
# version = "{revision}"
117+
}
118+
```
119+
120+
See respective module readme and examples for more details.

atlassian/.DS_Store

6 KB
Binary file not shown.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Atlassian
2+
3+
## Purpose
4+
5+
This module installs [Sumo Logic Atlassian application](https://help.sumologic.com/07Sumo-Logic-Apps/08App_Development/Atlassian) in Sumo Logic.
6+
7+
## Requirements
8+
9+
* Terraform >= 0.12.26
10+
* Null >= 2.1
11+
12+
## Module Declaration
13+
14+
This module requires Sumo Logic collector Id and Folder id as explained [here](https://github.com/SumoLogic/terraform-sumologic-integrations#prerequisites-for-using-modules).
15+
16+
```shell
17+
module "sumologic-jira-atlassian-app" {
18+
source = "[email protected]:SumoLogic/terraform-sumologic-integrations//atlassian/cloud/atlassian"
19+
sumo_access_id = "<SUMO_ACCESS_ID>"
20+
sumo_access_key = "<SUMO_ACCESS_KEY>"
21+
sumo_api_endpoint = "https://api.sumologic.com/api/v1/"
22+
opsgenie_source_category = "Atlassian/Opsgenie"
23+
jira_server_webhooks_source_category = "Atlassian/Jira/Events"
24+
jira_cloud_source_category = "Atlassian/Jira/Cloud"
25+
bitbucket_source_category = "Atlassian/Bitbucket"
26+
folder_id = sumologic_folder.folder.id
27+
app_version = "1.0"
28+
}
29+
```
30+
31+
## Inputs
32+
33+
| Name | Description | Type | Default | Required |
34+
|------|-------------|------|---------|:-----:|
35+
|sumo_access_id|[Sumo Logic Access ID](https://help.sumologic.com/Manage/Security/Access-Keys)|string||yes
36+
|sumo_access_key|[Sumo Logic Access Key](https://help.sumologic.com/Manage/Security/Access-Keys)|string||yes
37+
|sumo_api_endpoint|[Sumo Logic API Endpoint](https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security)|string|https://api.sumologic.com/api/v1/|yes
38+
|folder_id|Sumo Logic Folder ID|string||yes
39+
|opsgenie_source_category|Opsgenie Source Category|string|Atlassian/Opsgenie|yes
40+
|jira_cloud_source_category|Jira Cloud Source Category|string|Atlassian/Jira/Cloud|yes
41+
|jira_server_webhooks_source_category|Jira Server Source Category|string|Atlassian/Jira/Events|yes
42+
|bitbucket_source_category|Bitbucket Source Category|string|Atlassian/Bitbucket|yes
43+
|app_version|The app_version input parameter can be used to install a new copy of the app. When the app_version field is changed, it will force Terraform to install a new app folder with the current timestamp.|String|1.0|no
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Bitbucket
2+
variable "sumo_access_id" {
3+
type = string
4+
description = "Sumo Logic Access ID"
5+
}
6+
variable "sumo_access_key" {
7+
type = string
8+
description = "Sumo Logic Access Key"
9+
}
10+
variable "sumo_api_endpoint" {
11+
type = string
12+
description = "Sumo Logic Endpoint"
13+
default = "https://api.sumologic.com/api/v1/"
14+
}
15+
variable "folder_id" {
16+
type = string
17+
description = "Sumo Logic Content Folder ID"
18+
}
19+
variable "opsgenie_source_category" {
20+
type = string
21+
description = "Opsgenie Source Category"
22+
default = "Atlassian/Opsgenie"
23+
}
24+
variable "jira_cloud_source_category" {
25+
type = string
26+
description = "Jira Cloud Webhooks Source Category"
27+
default = "Atlassian/Jira/Cloud"
28+
}
29+
variable "jira_server_webhooks_source_category" {
30+
type = string
31+
description = "Jira Server Webhooks Source Category"
32+
default = "Atlassian/Jira/Events"
33+
}
34+
variable "bitbucket_source_category" {
35+
type = string
36+
description = "Bitbucket Cloud Source Category"
37+
default = "Atlassian/Bitbucket"
38+
}
39+
variable "app_version" {
40+
type = string
41+
description = "App Version"
42+
default = "1.0"
43+
}

atlassian/cloud/atlassian/main.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Generate timestamp to add to the folder name.
2+
locals {
3+
time_stamp = formatdate("DD-MMM-YYYY hh:mm:ss", timestamp())
4+
}
5+
6+
# Install Atlassian Solution App
7+
resource "null_resource" "install_atlassian_app" {
8+
9+
triggers = {
10+
version = var.app_version
11+
}
12+
13+
provisioner "local-exec" {
14+
command = <<EOT
15+
curl -s --request POST '${var.sumo_api_endpoint}apps/332afd45-eb37-4d65-85b5-21eaead37f6b/install' \
16+
--header 'Accept: application/json' \
17+
--header 'Content-Type: application/json' \
18+
-u "${var.sumo_access_id}:${var.sumo_access_key}" \
19+
--data-raw '{ "name": "Atlassian - ${local.time_stamp}", "description": "The Atlassian App provides insights into critical data across Atlassian applications, including Jira Cloud, Jira Server, Bitbucket, Atlassian Access, and OpsGenie from one pane-of-glass in a seamless dashboard experience.", "destinationFolderId": "${var.folder_id}","dataSourceValues": {"oglogsrc": "_sourceCategory = ${var.opsgenie_source_category}","jiralogsrc": "(_sourceCategory = ${var.jira_cloud_source_category} or _sourceCategory = ${var.jira_server_webhooks_source_category})","bblogsrc": "_sourceCategory = ${var.bitbucket_source_category}" }}'
20+
EOT
21+
}
22+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
terraform {
2+
required_version = ">= 0.12.26"
3+
4+
required_providers {
5+
null = {
6+
version = "~> 2.1"
7+
}
8+
}
9+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Bitbucket
2+
3+
## Purpose
4+
5+
This module installs [Sumo Logic Bitbucket application](https://help.sumologic.com/07Sumo-Logic-Apps/08App_Development/Bitbucket) in Sumo Logic and configures Webhooks in Bitbucket to send events to Sumo Logic.
6+
7+
## Requirements
8+
9+
* Terraform >= 0.12.26
10+
* Null >= 2.1
11+
* Bitbucket >= 1.2
12+
13+
## Module Declaration
14+
15+
This module requires Sumo Logic collector Id and Folder id as explained [here](https://github.com/SumoLogic/terraform-sumologic-integrations#prerequisites-for-using-modules).
16+
17+
### BitBucket Provider
18+
```shell
19+
provider "bitbucket" {
20+
username = "<BITBUCKET_USERNAME>"
21+
password = "<BITBUCKET_PASSWORD_OR_APP_PASSWORD"
22+
}
23+
```
24+
25+
### Bitbucket Module
26+
```shell
27+
module "sumologic-jira-bitbucket-app" {
28+
source = "[email protected]:SumoLogic/terraform-sumologic-integrations//atlassian/cloud/bitbucket"
29+
sumo_access_id = "<SUMO_ACCESS_ID>"
30+
sumo_access_key = "<SUMO_ACCESS_KEY>"
31+
sumo_api_endpoint = "https://api.sumologic.com/api/v1/"
32+
collector_id = sumologic_collector.atlassian_collector.id
33+
source_category = "Atlassian/Bitbucket"
34+
folder_id = sumologic_folder.folder.id
35+
bitbucket_cloud_owner = "<BITBUCKET_OWNER_NAME_OR_TEAM_NAME>"
36+
bitbucket_cloud_desc = "Send events to Sumo Logic"
37+
bitbucket_cloud_repos = ["<BITBUCKET_REPOSITORY_NAME1>", "<BITBUCKET_REPOSITORY_NAME2"]
38+
bitbucket_cloud_events = ["repo:push", "repo:fork", "repo:updated", "repo:commit_comment_created"] # By default all events are configured.
39+
app_version = "1.0"
40+
}
41+
```
42+
43+
## Inputs
44+
45+
| Name | Description | Type | Default | Required |
46+
|------|-------------|------|---------|:-----:|
47+
|sumo_access_id|[Sumo Logic Access ID](https://help.sumologic.com/Manage/Security/Access-Keys)|string||yes
48+
|sumo_access_key|[Sumo Logic Access Key](https://help.sumologic.com/Manage/Security/Access-Keys)|string||yes
49+
|sumo_api_endpoint|[Sumo Logic API Endpoint](https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security)|string|https://api.sumologic.com/api/v1/|yes
50+
|collector_id|Sumo Logic Collector ID|string||yes
51+
|folder_id|Sumo Logic Folder ID|string||yes
52+
|source_category|Bitbucket Source Category|string|Atlassian/Bitbucket|yes
53+
|bitbucket_cloud_owner|Bitbucket Owner Name or Team Name having access to reposiitories.|string||yes
54+
|bitbucket_cloud_desc|Bitbucket Webhook Description|string|Send events to Sumo Logic|yes
55+
|bitbucket_cloud_repos|Bitbucket Repository Names for which the Webhooks need to be configured.|list||yes
56+
|bitbucket_cloud_events|Bitbucket Events to Push to Sumo Logic|list|List of all the Bitbucket Cloud Events|yes
57+
|app_version|The app_version input parameter can be used to install a new copy of the app. When the app_version field is changed, it will force Terraform to install a new app folder with the current timestamp.|String|1.0|no
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Bitbucket
2+
variable "sumo_access_id" {
3+
type = string
4+
description = "Sumo Logic Access ID"
5+
}
6+
variable "sumo_access_key" {
7+
type = string
8+
description = "Sumo Logic Access Key"
9+
}
10+
variable "sumo_api_endpoint" {
11+
type = string
12+
description = "Sumo Logic Endpoint"
13+
default = "https://api.sumologic.com/api/v1/"
14+
}
15+
variable "collector_id" {
16+
type = string
17+
description = "Sumo Logic Collector ID"
18+
}
19+
variable "source_category" {
20+
type = string
21+
description = "Sumo Logic Bitbucket Source Category"
22+
default = "Atlassian/Bitbucket"
23+
}
24+
variable "folder_id" {
25+
type = string
26+
description = "Sumo Logic Content Folder ID"
27+
}
28+
variable "bitbucket_cloud_owner" {
29+
type = string
30+
description = "Bitbucket Cloud Owner"
31+
}
32+
variable "bitbucket_cloud_desc" {
33+
type = string
34+
description = "Bitbucket Cloud Webhook Description"
35+
default = "Send events to Sumo Logic"
36+
}
37+
variable "bitbucket_cloud_repos" {
38+
type = list
39+
description = "Bitbucket Cloud Repositories"
40+
default = []
41+
}
42+
variable "bitbucket_cloud_events" {
43+
type = list
44+
description = "Bitbucket Cloud Events"
45+
default = [
46+
"repo:push", "repo:fork", "repo:updated", "repo:commit_comment_created"
47+
, "repo:commit_status_updated", "repo:commit_status_created"
48+
, "issue:created", "issue:updated", "issue:comment_created"
49+
, "pullrequest:created", "pullrequest:updated", "pullrequest:approved", "pullrequest:unapproved", "pullrequest:fulfilled", "pullrequest:rejected"
50+
, "pullrequest:comment_created", "pullrequest:comment_updated", "pullrequest:comment_deleted"
51+
]
52+
}
53+
variable "app_version" {
54+
type = string
55+
description = "App Version"
56+
default = "1.0"
57+
}

0 commit comments

Comments
 (0)