62 lines
1.2 KiB
HCL
62 lines
1.2 KiB
HCL
terraform {
|
|
backend "pg" {
|
|
schema_name = "shoarma-elasticsearch"
|
|
}
|
|
|
|
required_providers {
|
|
elasticstack = {
|
|
source = "elastic/elasticstack"
|
|
version = "0.6.2"
|
|
}
|
|
}
|
|
}
|
|
|
|
provider "elasticstack" {
|
|
elasticsearch {
|
|
endpoints = ["http://maestro.dmz:14653"]
|
|
}
|
|
}
|
|
|
|
resource "elasticstack_elasticsearch_index_lifecycle" "metrics_ilm" {
|
|
name = "metrics_ilm"
|
|
|
|
delete {
|
|
min_age = "7d"
|
|
delete {}
|
|
}
|
|
}
|
|
|
|
resource "elasticstack_elasticsearch_index_template" "metrics_template" {
|
|
name = "metrics_template"
|
|
|
|
priority = 42
|
|
index_patterns = ["fluentd.cpu-*", "fluentd.memory-*", "fluentd.diskfree-*"]
|
|
|
|
template {
|
|
settings = jsonencode({
|
|
"index.lifecycle.name" = elasticstack_elasticsearch_index_lifecycle.metrics_ilm.name
|
|
})
|
|
}
|
|
}
|
|
|
|
resource "elasticstack_elasticsearch_index_lifecycle" "logs_ilm" {
|
|
name = "logs_ilm"
|
|
|
|
delete {
|
|
min_age = "2d"
|
|
delete {}
|
|
}
|
|
}
|
|
|
|
resource "elasticstack_elasticsearch_index_template" "logs_template" {
|
|
name = "logs_template"
|
|
|
|
priority = 42
|
|
index_patterns = ["fluentd.docker.**"]
|
|
|
|
template {
|
|
settings = jsonencode({
|
|
"index.lifecycle.name" = elasticstack_elasticsearch_index_lifecycle.logs_ilm.name
|
|
})
|
|
}
|
|
}
|