Skip to content

menai34/terraform-provider-graylog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Provider Graylog

Fork from https://github.com/rebuy-de/terraform-provider-graylog

Terraform Provider Graylog

Build Status license GitHub release

A Terraform provider for configuring Graylog.

Development Status terraform-provider-graylog is in an early development stage. By far not all possible resources are covered yet and the existing ones might be incomplete. You are encouraged to pinpoint missing features by creating Issues or Pull Requests.

Use Case

The terraform-provider-graylog can be used to provision a new (or even an existing) Graylog installation. Putting the configuration into code makes it easily reproducable, less error prone and changes reviewable. Furthermore Terraform became a very convinient way for doing Infrastructure-as-Code everywhere.

Example

At the beginning you need to setup the Graylog server URL and its credentials:

provider "graylog" {
    server_url = "http://localhost:9000"
    username   = "admin"
    password   = "admin"
}

Alternatively you can define these parameters via environment variables GRAYLOG_SERVER_URL, GRAYLOG_USERNAME and GRAYLOG_PASSWORD.

The next step is to create actual Graylog resource. For example a GELF UDP input like in this example:

resource "graylog_input" "gelf_udp" {
  title  = "GELF UDP"
  global = true

  gelf_udp {
    bind_address = "0.0.0.0"
    port         = 22201
  }
}

Reference

The following arguments are supported in the provider block:

  • server_url - This is the URL to the Graylog API, eg http://localhost:9000. This value can be set by the environment variable GRAYLOG_SERVER_URL.
  • username - This is the username for the API user. This value cn be set by the environment variable GRAYLOG_USERNAME.
  • password - This is the password for the API user. This value cn be set by the environment variable GRAYLOG_PASSWORD.

graylog_input

Arguments

The following arguments are supported:

  • title - The title of the input.
  • global - (Optional) If true, the input will be installed on all nodes.
  • node - (Optional) The ID of the node where to install the input. Required, if global is set to true.
  • gelf_udp - (Optional) The configuration as a GELF UDP input (documented below). Only on input type is allowed.
  • gelf_tcp - (Optional) The configuration as a GELF UDP input (documented below). Only on input type is allowed.
  • beats - (Optional) The configuration as a GELF UDP input (documented below). Only on input type is allowed.

The gelf_udp block supports the following:

  • port - The port where the input should listen to.
  • bind_address - (Optional) The IP address where to bind the input to. Defaults to 0.0.0.0.

The gelf_tcp block supports the following:

  • port - The port where the input should listen to.
  • bind_address - (Optional) The IP address where to bind the input to. Defaults to 0.0.0.0.

The beats block supports the following:

  • port - The port where the input should listen to.
  • bind_address - (Optional) The IP address where to bind the input to. Defaults to 0.0.0.0.

Attributes

The following attributes are exported:

  • name - The name of the input, eg GELF UDP.
  • type - The type of the input, eg org.graylog2.inputs.gelf.udp.GELFUDPInput.

Developing

Testing

The test mainly consist of acceptance tests. To run them you need a disposable Graylog instance. You can easily create this via Docker. The script in examples/run-graylog.sh can be used to create a ready Graylog instance.

To start the tests you need to confure the environment variables and then run:

TF_ACC=1 go test . -v

About

Terraform graylog provider

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages