From 0664801e89c37da51781031adb42ceafb4070602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20B=C3=A9jean?= <nicolas@bejean.fr> Date: Thu, 9 Dec 2021 20:49:01 +0100 Subject: [PATCH] Add Elastic Cluster Directive --- manifests/elastic/main.tf | 34 +++++++++++++++++++++++++++++++++- manifests/elastic/variables.tf | 7 ++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/manifests/elastic/main.tf b/manifests/elastic/main.tf index 5c0f658..5a86d27 100644 --- a/manifests/elastic/main.tf +++ b/manifests/elastic/main.tf @@ -9,4 +9,36 @@ terraform { provider "ec" { apikey = var.ec_apikey -} \ No newline at end of file +} + +data "ec_stack" "stack" { + version_regex = "7.15.2" + region = var.region +} + +resource "ec_deployment" "elasticsearch_cluster" { + name = "mon-cluster" + + region = data.ec_stack.stack.region + version = data.ec_stack.stack.version_regex + deployment_template_id = "gcp-storage-optimized" + + elasticsearch { + autoscale = "false" + + topology { + id = "hot_content" + size_resource = "memory" + size = "1g" + zone_count = 1 + } + } + + kibana { + topology { + size_resource = "memory" + size = "1g" + zone_count = 1 + } + } +} diff --git a/manifests/elastic/variables.tf b/manifests/elastic/variables.tf index 2b4efd3..1c47852 100644 --- a/manifests/elastic/variables.tf +++ b/manifests/elastic/variables.tf @@ -1,3 +1,8 @@ variable "ec_apikey" { type = string -} \ No newline at end of file +} + +variable "region" { + type = string + default = "gcp-europe-west1" +} -- GitLab