-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Closed
Labels
Description
It would be very useful if Terraform could manage Elasticsearch resources, such as indices, index templates, search templates, etc. I've started prototyping an implementation that covers my current needs, which are limited to index templates. Opening this issue to track API, work, feedback, etc.
I'm currently targeting Elasticsearch 5 and up.
Index templates
resource "elasticsearch_index_template" "test" {
name = "terraform-test"
template = "tf-*"
order = 1
settings {
index.number_of_shards = 5
}
mapping {
type = "reports"
date_property {
name = "created_at"
format = "EEE MMM dd HH:mm:ss Z YYYY"
}
keyword_property {
name = "subject"
}
}
}
API reference: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html
PUT _template/terraform-test
{
"template": "tf-*",
"order": 1,
"settings": {
"index.number_of_shards": 5
},
"mappings": {
"reports": {
"properties": {
"created_at": {
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z YYYY"
},
"subject": {
"type": "keyword"
}
}
}
}
}