chaossearch_destination Resource

The chaossearch_destination resource creates an alerting destination resource.

You can send notifications to destinations such as Slack channels or Webhook integrations. These resources are part of the Search Analytics > Alerts user interface area. After you create a destination, you can create one or more monitors to specify conditions to watch for, and which will trigger notifications to a destination when activated.

For more information about creating destinations, see Alert Destinations.

📘

Destinations require user_name/password authentication.

When you define destination resources in your Terraform files, you must specify a username/password login pair because API key authentication is not supported for destinations. If you specify only an API key and secret combination, the chaossearch_destination resource fails and displays the error:
Error: Failed to authenticate => API Keys used with incompatible resource

Example Usage

The structure of a destination resource for a Slack channel follows:

resource "chaossearch_destination" "dest" {  
  name = "tf-provider-destination"  
  type = "slack"  
  slack {  
    url = "<http://mycompany.slack.com/archives/ABCDE12345>"  
  }  
}

📘

Resource restrictions

The slack and custom_webhook configurations cannot both be declared in the same resource block.

The structure of a destination resource for a custom Webhook defined by a URL follows:

resource "chaossearch_destination" "dest_custom" {  
  name = "tf-provider-destination-custom"  
  type = "custom_webhook"  
  custom_webhook {  
    url = "<http://test.com>"  
  }  
}

The structure of a destination resource for a custom Webhook defined by custom attributes follows:

resource "chaossearch_destination" "dest_custom_host" {  
  name = "tf-provider-destination-custom-host"  
  type = "custom_webhook"  
  custom_webhook {  
    scheme = "HTTPS"  
    host = "test.com"  
    path = "/api/test"  
    port = "8080"  
    method = "POST"  
    query_params = jsonencode({  
      "test": "value"  
    })  
    header_params = jsonencode({  
      "Content-Type": "application/json"  
    })  
  }  
}

📘

Custom webhook notes

When using a custom_webhook defined by custom attributes, ignore the url value and specify the required attributes in the host, path, port, scheme and related attribute-specific fields.

Argument Reference

Field

Required

Description

name

Yes

The name of the destination

type

Yes

Specifies whether the destination is of type slack or custom_webhook.

slack

No

Defines a Slack channel destination

url

No

The URL for the Slack channel

custom_webhook

No

The URL for the custom webhook

url

No

For a custom webhook defined by URL, specify the URL of the destination. No other fields are needed.

As an alternative to url, you can specify the attributes individually using the following fields.

scheme

No

For a custom webhook defined by attributes, specify the webhook protocol as either HTTP or HTTPS.

host

No

For a custom webhook defined by attributes, specify the host domain.

path

No

For a custom webhook defined by attributes, specify the target path.

port

No

For a custom webhook defined by attributes, specify the port value.

method

No

For a custom webhook defined by attributes, specify the REST method such as POST, PUT, or PATCH.

query_params

No

For a custom webhook defined by attributes, specify any required key/value query parameters inside a jsonencode structure.

header_params

No

For a custom webhook defined by attributes, specify any required header information values inside a jsonencode structure.