An open API service indexing awesome lists of open source software.

https://github.com/ewilde/terraform-provider-kibana

Kibana terraform provider
https://github.com/ewilde/terraform-provider-kibana

Last synced: 4 months ago
JSON representation

Kibana terraform provider

Awesome Lists containing this project

README

          

Terraform Provider
==================

- [![Test Status](https://github.com/ewilde/terraform-provider-kibana/workflows/Tests/badge.svg)](https://github.com/ewilde/terraform-provider-kibana/actions?query=workflow%3ATests)
- Website: https://registry.terraform.io/providers/ewilde/kibana/latest

## Requirements

- [Terraform](https://www.terraform.io/downloads.html) 0.10.x
- [Go](https://golang.org/doc/install) 1.9 (to build the provider plugin)

## Usage

```
# For example, restrict kibana terraform provider to version 0.6.3 and use the default kibana version and configuration based on environment variables
provider "kibana" {
version = "0.6.3"
}

# Connecting to Kibana 7.3.1
provider "kibana" {
"kibana_version" = "7.3.1"
"kibana_username" = "admin"
"kibana_password" = "123"
}

# Connecting to logz.io
provider "kibana" {
"kibana_type" = "KibanaTypeLogzio"
"kibana_username" = "admin"
"kibana_password" = "123"
}

# Connecting to logz.io using MFA
provider "kibana" {
"kibana_type" = "KibanaTypeLogzio"
"kibana_username" = "admin"
"kibana_password" = "123"
"logzio_mfa_secret" = "MFSD56CBOEWGFRKTOE7WKMLRHEDXUMLY"
}

```

### Argument Reference

In addition to [generic `provider` arguments](https://www.terraform.io/docs/configuration/providers.html)
(e.g. `alias` and `version`), the following arguments are supported in the Kibana
`provider` block:

* `kibana_version` - (Optional) Version of kibana that is being configured see [supported versions](#supported-kibana-versions).
If omitted, default value is `6.0.0`.

* `kibana_type` - (Optional) Type of Kibana back end, defaults to `KibanaTypeVanilla` which supports the
[standard open-source kibana distribution](https://github.com/elastic/kibana). To configure [logz.io](https://logz.io)
kibana use `KibanaTypeLogzio`

* `kibana_username` - (Optional) username when authenticating with the Kibana API.

* `kibana_password` - (Optional) password when authenticating with the Kibana API.

* `logzio_client_id` - (Optional) client id used during [authentication with logzio](#authenticating-with-logzio).

* `logzio_account_id` - (Optional) logz.io account id.

* `logzio_mfa_secret` - (Optional) MFA shared secret, create when signing up user account with MFA.

* `kibana_insecure` - (Optional) Explicitly allow the provider to perform "insecure" SSL requests.
If omitted, default value is `false`.

### Supported kibana versions

Below is the list of kibana versions known to work

Standard Kibana:

- 5.5.3
- 6.2.1
- 6.3.2
- 6.4.1
- 7.3.1

Logzio kibana:

- 6.3.2

### Authenticating with logz.io
Two modes are supported:

1. User name and password
2. User name and password + MFA

In both cases the logzio client id must be supplied, and can be found during login be inspecting the network traffic,
this value is not considered sensitive and we have observed it is always `kydHH8LqsLR6D6d2dlHTpPEdf0Bztz4c`.

![image](https://user-images.githubusercontent.com/329397/68251418-fbb03400-001a-11ea-9214-ca0e0429040c.png)

## Using the provider

### Installation

The provider is available on the [Terraform Registry](https://registry.terraform.io/providers/ewilde/kibana/latest).

Require it within your project:

```
terraform {
required_providers {
kibana = {
source = "ewilde/kibana"
}
}
}

provider "kibana" {
}
```

You can then use all the provided resources datasources

### Example creating saved search, visualization and dashboard resources
```hcl
data "kibana_index" "main" {
filter {
name = "title"
values = ["logstash-*"]
}
}

resource "kibana_search" "china" {
name = "Chinese origin - errors"
description = "Errors occured when source was from china"
display_columns = ["_source"]
sort_by_columns = ["@timestamp"]
search {
index = "${data.kibana_index.main.id}"
filters {
match {
field_name = "geo.src"
query = "CN"
type = "phrase"
}
}

filters {
match {
field_name = "@tags"
query = "error"
type = "phrase"
}
}
}
}

resource "kibana_visualization" "china_viz" {
name = "Chinese visualization - updated"
description = "Chinese error visualization - updated"
saved_search_id = "${kibana_search.china.id}"
visualization_state = <