Skip to content

Commit

Permalink
Merge pull request #18 from STLVRTX:master
Browse files Browse the repository at this point in the history
update provider to v2 api changes and add new incident com resources
  • Loading branch information
yacut authored Jul 14, 2022
2 parents d9c7bba + 670af20 commit ced8e70
Show file tree
Hide file tree
Showing 60 changed files with 3,685 additions and 433 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ bin/
.terraform*
terraform.tfstate*
crash.log
*.tfvars
*.tfvars
*.tfrc
test/
16 changes: 16 additions & 0 deletions examples/alert_action/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Alert Action Example

This demos [alert actions and connectors](https://docs.ilert.com/getting-started/intro#connectors-and-alert-actions-aka-outbound-integrations).

This example will create an alert source, a connector and alert action in the specified organization. See https://registry.terraform.io/providers/iLert/ilert/latest/docs for details on configuring [`providers.tf`](./providers.tf) accordingly.

Alternatively, you may use variables passed via command line:

```sh
export ILERT_API_TOKEN=
```

```sh
terraform apply \
-var "api_token=${ILERT_API_TOKEN}" \
```
36 changes: 36 additions & 0 deletions examples/alert_action/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
data "ilert_escalation_policy" "default" {
name = "Default"
}

resource "ilert_alert_source" "example" {
name = "My Grafana Integration for GitHub"
integration_type = "GRAFANA"
escalation_policy = data.ilert_escalation_policy.default.id
}

resource "ilert_connector" "example" {
name = "My GitHub Connector"
type = "github"

github {
api_key = "my api key"
}
}

resource "ilert_alert_action" "example" {
name = "My GitHub Alert Action"

alert_source {
id = ilert_alert_source.example.id
}

connector {
id = ilert_connector.example.id
type = ilert_connector.example.type
}

github {
owner = "my org"
repository = "my repo"
}
}
13 changes: 13 additions & 0 deletions examples/alert_action/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
terraform {
required_providers {
ilert = {
source = "iLert/ilert"
version = "~> 1.0"
}
}
}

provider "ilert" {
endpoint = var.endpoint
api_token = var.api_token
}
10 changes: 10 additions & 0 deletions examples/alert_action/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
variable "api_token" {
description = "iLert API token used to configure the provider"
type = string
}

variable "endpoint" {
description = "iLert organization used to configure the provider"
type = string
default = "https://api.ilert.com"
}
14 changes: 5 additions & 9 deletions examples/alert_source/variables.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
variable "organization" {
description = "iLert organization used to configure the provider"
variable "api_token" {
description = "iLert API token used to configure the provider"
type = string
}

variable "username" {
description = "iLert username used to configure the provider"
type = string
}

variable "password" {
description = "iLert password used to configure the provider"
variable "endpoint" {
description = "iLert organization used to configure the provider"
type = string
default = "https://api.ilert.com"
}
25 changes: 25 additions & 0 deletions examples/automation_rule/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
data "ilert_escalation_policy" "default" {
name = "Default"
}

data "ilert_service" "example" {
name = "example"
}

resource "ilert_alert_source" "example" {
name = "My Grafana Integration from terraform"
integration_type = "GRAFANA"
escalation_policy = data.ilert_escalation_policy.default.id
}

resource "ilert_automation_rule" "example" {
alert_type = "CREATED"
service_status = "OPERATIONAL"
service {
id = data.ilert_service.example.id
}

alert_source {
id = ilert_alert_source.example.id
}
}
13 changes: 13 additions & 0 deletions examples/automation_rule/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
terraform {
required_providers {
ilert = {
source = "iLert/ilert"
version = "~> 1.6"
}
}
}

provider "ilert" {
endpoint = var.endpoint
api_token = var.api_token
}
10 changes: 10 additions & 0 deletions examples/automation_rule/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
variable "api_token" {
description = "iLert API token used to configure the provider"
type = string
}

variable "endpoint" {
description = "iLert organization used to configure the provider"
type = string
default = "https://api.ilert.com"
}
2 changes: 2 additions & 0 deletions examples/connection/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Connection Example

> Legacy API - please use alert-actions - for more information see https://docs.ilert.com/rest-api/api-version-history#renaming-connections-to-alert-actions
This demos [connections and connectors](https://docs.ilert.com/getting-started/intro#connectors-and-connections-outbond-integrations).

This example will create an alert source, a connector and connection in the specified organization. See https://registry.terraform.io/providers/iLert/ilert/latest/docs for details on configuring [`providers.tf`](./providers.tf) accordingly.
Expand Down
14 changes: 2 additions & 12 deletions examples/connection/variables.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
variable "organization" {
description = "iLert organization used to configure the provider"
type = string
}

variable "username" {
description = "iLert username used to configure the provider"
type = string
}

variable "password" {
description = "iLert password used to configure the provider"
variable "api_token" {
description = "iLert API token used to configure the provider"
type = string
}

Expand Down
1 change: 0 additions & 1 deletion examples/escalation_policy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ resource "ilert_escalation_policy" "example" {
user = data.ilert_user.example.id
}
}

14 changes: 5 additions & 9 deletions examples/escalation_policy/variables.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
variable "organization" {
description = "iLert organization used to configure the provider"
variable "api_token" {
description = "iLert API token used to configure the provider"
type = string
}

variable "username" {
description = "iLert username used to configure the provider"
type = string
}

variable "password" {
description = "iLert password used to configure the provider"
variable "endpoint" {
description = "iLert organization used to configure the provider"
type = string
default = "https://api.ilert.com"
}
4 changes: 4 additions & 0 deletions examples/incident_template/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "ilert_incident_template" "example" {
name = "example"
status = "INVESTIGATING"
}
13 changes: 13 additions & 0 deletions examples/incident_template/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
terraform {
required_providers {
ilert = {
source = "iLert/ilert"
version = "~> 1.6"
}
}
}

provider "ilert" {
endpoint = var.endpoint
api_token = var.api_token
}
10 changes: 10 additions & 0 deletions examples/incident_template/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
variable "api_token" {
description = "iLert API token used to configure the provider"
type = string
}

variable "endpoint" {
description = "iLert organization used to configure the provider"
type = string
default = "https://api.ilert.com"
}
13 changes: 13 additions & 0 deletions examples/service/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource "ilert_team" "example"{
name = "example"
}

resource "ilert_service" "example" {
name = "example"
status = "OPERATIONAL"
description = "example iLert service"

team {
id = ilert_team.example.id
}
}
13 changes: 13 additions & 0 deletions examples/service/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
terraform {
required_providers {
ilert = {
source = "iLert/ilert"
version = "~> 1.6"
}
}
}

provider "ilert" {
endpoint = var.endpoint
api_token = var.api_token
}
10 changes: 10 additions & 0 deletions examples/service/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
variable "api_token" {
description = "iLert API token used to configure the provider"
type = string
}

variable "endpoint" {
description = "iLert organization used to configure the provider"
type = string
default = "https://api.ilert.com"
}
13 changes: 13 additions & 0 deletions examples/status_page/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
data "ilert_service" "example" {
name = "example"
}

resource "ilert_status_page" "example" {
name = "example"
subdomain = "example.ilerthq.com"
visibility = "PUBLIC"

service {
id = data.ilert_service.example.id
}
}
13 changes: 13 additions & 0 deletions examples/status_page/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
terraform {
required_providers {
ilert = {
source = "iLert/ilert"
version = "~> 1.6"
}
}
}

provider "ilert" {
endpoint = var.endpoint
api_token = var.api_token
}
10 changes: 10 additions & 0 deletions examples/status_page/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
variable "api_token" {
description = "iLert API token used to configure the provider"
type = string
}

variable "endpoint" {
description = "iLert organization used to configure the provider"
type = string
default = "https://api.ilert.com"
}
1 change: 0 additions & 1 deletion examples/uptime_monitor/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ resource "ilert_uptime_monitor" "terraform" {
url = "https://www.terraform.io"
}
}

14 changes: 5 additions & 9 deletions examples/uptime_monitor/variables.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
variable "organization" {
description = "iLert organization used to configure the provider"
variable "api_token" {
description = "iLert API token used to configure the provider"
type = string
}

variable "username" {
description = "iLert username used to configure the provider"
type = string
}

variable "password" {
description = "iLert password used to configure the provider"
variable "endpoint" {
description = "iLert organization used to configure the provider"
type = string
default = "https://api.ilert.com"
}
14 changes: 5 additions & 9 deletions examples/user/variables.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
variable "organization" {
description = "iLert organization used to configure the provider"
variable "api_token" {
description = "iLert API token used to configure the provider"
type = string
}

variable "username" {
description = "iLert username used to configure the provider"
type = string
}

variable "password" {
description = "iLert password used to configure the provider"
variable "endpoint" {
description = "iLert organization used to configure the provider"
type = string
default = "https://api.ilert.com"
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.17

require (
github.com/hashicorp/terraform-plugin-sdk/v2 v2.8.0
github.com/iLert/ilert-go v1.6.5
github.com/iLert/ilert-go/v2 v2.0.5
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKe
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ=
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/iLert/ilert-go v1.6.5 h1:u9264uv08FK6JrcvNbvIVBDB33oOWFInW4FZsM0/IXU=
github.com/iLert/ilert-go v1.6.5/go.mod h1:4+2rQ2DQqnDPMB+bUpNKejYRmu4YvnQg7Cu4AjsP1J8=
github.com/iLert/ilert-go/v2 v2.0.5 h1:SoduqO98Wuktqf3MDJMV3QcXJAaX+80koOEpXE/f+4g=
github.com/iLert/ilert-go/v2 v2.0.5/go.mod h1:wIR6yXgr0H0rJkXYJxVdUVHzNz3jr+qoQO85ATK3ae0=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
Expand Down
Loading

0 comments on commit ced8e70

Please sign in to comment.