From 21bd3e89037cd158c8eaf2695284a191bf4117fb Mon Sep 17 00:00:00 2001 From: yacut Date: Tue, 20 Oct 2020 23:16:32 +0200 Subject: [PATCH] add docs --- ilert/resource_alert_source.go | 8 ++-- .../d/alert_source_data_source.html.markdown | 32 +++++++++++++ website/docs/index.html.markdown | 42 ++++++++++++++++ .../r/alert_source_resource.html.markdown | 48 +++++++++++++++++++ 4 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 website/docs/d/alert_source_data_source.html.markdown create mode 100644 website/docs/index.html.markdown create mode 100644 website/docs/r/alert_source_resource.html.markdown diff --git a/ilert/resource_alert_source.go b/ilert/resource_alert_source.go index c5c768b..6316f7e 100644 --- a/ilert/resource_alert_source.go +++ b/ilert/resource_alert_source.go @@ -75,7 +75,7 @@ func resourceAlertSource() *schema.Resource { "KENTIXAM", }), }, - "escalation_policy_id": { + "escalation_policy": { Type: schema.TypeInt, Required: true, ForceNew: false, @@ -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), }, } @@ -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) @@ -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 { diff --git a/website/docs/d/alert_source_data_source.html.markdown b/website/docs/d/alert_source_data_source.html.markdown new file mode 100644 index 0000000..dc565fd --- /dev/null +++ b/website/docs/d/alert_source_data_source.html.markdown @@ -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 diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown new file mode 100644 index 0000000..0fee9f8 --- /dev/null +++ b/website/docs/index.html.markdown @@ -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/` diff --git a/website/docs/r/alert_source_resource.html.markdown b/website/docs/r/alert_source_resource.html.markdown new file mode 100644 index 0000000..a211b5e --- /dev/null +++ b/website/docs/r/alert_source_resource.html.markdown @@ -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 +```