From 19f4e221d06ee3c49055490e6951d073d5d3cf80 Mon Sep 17 00:00:00 2001 From: Joseph Page Date: Fri, 15 Sep 2023 21:28:06 +0200 Subject: [PATCH] feat: add new type of log_drains and validate input --- variables.tf | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/variables.tf b/variables.tf index 6325705..4f5d406 100644 --- a/variables.tf +++ b/variables.tf @@ -184,9 +184,23 @@ variable "domain_aliases" { variable "log_drains" { type = list(object({ - type = string - url = optional(string, "") + type = string + url = optional(string, "") + drain_region = optional(string, "") + addon = optional(string, "") + host = optional(string, "") + port = optional(string, "") + token = optional(string, "") + })) default = [] nullable = false + + validation { + condition = length([ + for drain in var.log_drains : + drain if !contains(["elk", "appsignal", "logtail", "datadog", "ovh-graylog", "papertrail", "logtail", "syslog"], drain.type) + ]) == 0 + error_message = "The list of log drains must contain only valid log drains type (elk/appsignal/logtail/datadog/ovh-graylog/papertrail/logtail/syslog)." + } }