Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
yacut committed Oct 20, 2020
1 parent 74c0522 commit 21bd3e8
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ilert/resource_alert_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func resourceAlertSource() *schema.Resource {
"KENTIXAM",
}),
},
"escalation_policy_id": {
"escalation_policy": {
Type: schema.TypeInt,
Required: true,
ForceNew: false,
Expand Down Expand Up @@ -405,7 +405,7 @@ func resourceAlertSourceCreate(d *schema.ResourceData, m interface{}) error {
Name: d.Get("name").(string),
IntegrationType: d.Get("integration_type").(string),
EscalationPolicy: &ilert.EscalationPolicy{
ID: d.Get("escalation_policy_id").(int64),
ID: d.Get("escalation_policy").(int64),
},
}

Expand Down Expand Up @@ -441,7 +441,7 @@ func resourceAlertSourceRead(d *schema.ResourceData, m interface{}) error {

d.Set("name", result.AlertSource.Name)
d.Set("integration_type", result.AlertSource.IntegrationType)
d.Set("escalation_policy_id", result.AlertSource.EscalationPolicy.ID)
d.Set("escalation_policy", result.AlertSource.EscalationPolicy.ID)
d.Set("incident_creation", result.AlertSource.IncidentCreation)
d.Set("active", result.AlertSource.Active)
d.Set("incident_priority_rule", result.AlertSource.IncidentPriorityRule)
Expand Down Expand Up @@ -525,7 +525,7 @@ func resourceAlertSourceUpdate(d *schema.ResourceData, m interface{}) error {
Name: d.Get("name").(string),
IntegrationType: d.Get("integration_type").(string),
EscalationPolicy: &ilert.EscalationPolicy{
ID: int64(d.Get("escalation_policy_id").(int)),
ID: int64(d.Get("escalation_policy").(int)),
},
}
if val, ok := d.GetOk("incident_creation"); ok {
Expand Down
32 changes: 32 additions & 0 deletions website/docs/d/alert_source_data_source.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
layout: "ilert"
page_title: "iLert: alert_source_data_source"
sidebar_current: "docs-ilert-alert-source-data-source"
description: |-
Get information about an alert source that you have created.
---

# ilert_alert_source

Use this data source to get information about a specific [alert source][1].

## Example Usage

```hcl
data "ilert_alert_source" "example" {
name = "foo"
}
```

## Argument Reference

The following arguments are supported:

- `name` - (Required) The alert source name to use to find an alert source in the iLert API.

## Attributes Reference

- `id` - The ID of the found alert source.
- `name` - The name of the found alert source.

[1]: https://api.ilert.com/api-docs/#tag/Alert-Sources
42 changes: 42 additions & 0 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
layout: "ilert"
page_title: "Provider: iLert"
sidebar_current: "docs-ilert-index"
description: |-
Terraform provider iLert.
---

# iLert Provider

The iLert provider is used to interact with iLert resources.

Use the navigation to the left to read about the available resources.

## Example Usage

```hcl
provider "ilert" {
organization = "your organization"
username = "your username"
password = "password"
}
# Example resource configuration
resource "alert_source_resource" "example" {
# ...
}
```

## Argument Reference

The following arguments are supported in the `provider` block:

- `api_token` - (Optional) A iLert OAuth / Personal Access Token. When not provided or made available via the `ILERT_API_TOKEN` environment variable, the provider can only access resources available anonymously. Conflicts with `organization`

- `organization` - (Optional) This is the target iLert organization account to manage. It is optional to provide this value and it can also be sourced from the `ILERT_ORGANIZATION` environment variable. For example, `ilert` is a valid organization. Conflicts with `api_token` and requires `username` and `password`, as the individual account corresponding to provided `username` and `password` will need "owner" privileges for this organization.

- `username` - (Optional) A iLert username. When not provided or made available via the `ILERT_USERNAME` environment variable.

- `password` - (Optional) A iLert password. When not provided or made available via the `ILERT_PASSWORD` environment variable.

- `endpoint` - (Optional) This is the target iLert base API endpoint. Providing a value is a requirement when working with iLert Enterprise. It is optional to provide this value and it can also be sourced from the `ILERT_ENDPOINT` environment variable. The value must end with a slash, for example: `https://ilert.example.com/`
48 changes: 48 additions & 0 deletions website/docs/r/alert_source_resource.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
layout: "ilert"
page_title: "iLert: ilert_alert_source"
sidebar_current: "docs-ilert-resource-alert-source"
description: |-
Creates and manages an alert source in iLert.
---

# ilert_alert_source

An [alert source](https://api.ilert.com/api-docs/#tag/Alert-Sources) represents the connection between your tools (usually a monitoring system, a ticketing tool, or an application) and iLert. We often refer to alert sources as inbound integrations.

## Example Usage

```hcl
resource "ilert_alert_source" "example" {
name = "My Grafana Integration"
integration_type = "GRAFANA"
escalation_policy = ilert_escalation_policy.example.id
}
```

## Argument Reference

The following arguments are supported:

- `name` - (Required) The name of the alert source.
- `integration_type` - (Required) The integration type of the alert source.
- `escalation_policy` - (Required) The escalation policy used by this alert source.
- `incident_creation` - (Optional) iLert receives events from your monitoring systems and can then create incidents in different ways. This option is recommended.
- `active` - (Optional) The state of the alert source. Default: true.
- `incident_priority_rule` - (Optional) The incident priority rule. This option is recommended.

## Attributes Reference

The following attributes are exported:

- `id` - The ID of the alert source.
- `status`- The status of the alert source
- `integration_key`- The integration key of the service

## Import

Services can be imported using the `id`, e.g.

```
$ terraform import ilert_alert_source.main 123456789
```

0 comments on commit 21bd3e8

Please sign in to comment.