diff --git a/main.tf b/main.tf index c7fa79f2..e4ab92ca 100644 --- a/main.tf +++ b/main.tf @@ -264,7 +264,14 @@ resource "helm_release" "cloud_monitoring_agent" { "name": "tmp-vol" %{endif~} EOT - ] +,yamlencode({ + "prometheus": { + "file": var.prometheus.file, + "yaml": var.prometheus.yaml + } +}) + +] provisioner "local-exec" { command = "${path.module}/scripts/confirm-rollout-status.sh ${var.name} ${var.namespace}" diff --git a/variables.tf b/variables.tf index 605a35c5..48136bd0 100644 --- a/variables.tf +++ b/variables.tf @@ -280,6 +280,25 @@ variable "container_filter" { } } +variable "prometheus" { + description = "Prometheus configuration for the agent. If you want to enable Prometheus configuration, set `file` to true and provide the prometheus.yaml file content in `yaml`." + type = object({ + file = bool + yaml = map(any) + }) + default = { + file = false + yaml = {} + } + validation { + condition = ( + var.prometheus.file == false || length(keys(var.prometheus.yaml)) > 0 + ) + error_message = "If prometheus.file is true, 'yaml' must be a non-empty map." + } +} + + ############################################################################## # SCC-WP related variables ##############################################################################