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

FieldRequiredDescription
nameYesThe name of the destination
typeYesSpecifies whether the destination is of type slack or custom_webhook.
slackNoDefines a Slack channel destination
urlNoThe URL for the Slack channel
custom_webhookNoThe URL for the custom webhook
urlNoFor 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.
schemeNoFor a custom webhook defined by attributes, specify the webhook protocol as either HTTP or HTTPS.
hostNoFor a custom webhook defined by attributes, specify the host domain.
pathNoFor a custom webhook defined by attributes, specify the target path.
portNoFor a custom webhook defined by attributes, specify the port value.
methodNoFor a custom webhook defined by attributes, specify the REST method such as POST, PUT, or PATCH.
query_paramsNoFor a custom webhook defined by attributes, specify any required key/value query parameters inside a jsonencode structure.
header_paramsNoFor a custom webhook defined by attributes, specify any required header information values inside a jsonencode structure.