56 lines
2.2 KiB
HCL
56 lines
2.2 KiB
HCL
# variables.tf
|
|
|
|
# Define datasources (non-sensitive metadata only)
|
|
variable "datasources" {
|
|
description = <<EOT
|
|
Map of datasources to create. Keys are datasource names.
|
|
Each datasource specifies type (prometheus/loki/tempo), keys to lookup URL/user/password,
|
|
and optional configurations for linking data sources.
|
|
EOT
|
|
type = map(object({
|
|
type = string # e.g., prometheus, loki, tempo
|
|
url_key = string # key for URL lookup in datasource_urls map
|
|
user_key = string # key for username lookup in datasource_users map
|
|
pass_key = string # key for password lookup in datasource_passwords map
|
|
is_default = optional(bool) # true if this datasource should be Grafana default
|
|
json_data = optional(map(any)) # Initial, non-dependent JSON data
|
|
|
|
# Optional: For Loki, to link to a tracing datasource like Tempo.
|
|
derived_fields = optional(list(object({
|
|
target_datasource_name = string # The name of the target datasource (e.g., "tempo-main")
|
|
matcher_regex = string # Regex to find the trace ID in logs.
|
|
name = string # Name for the derived field (e.g., "traceID")
|
|
url = string # URL template, e.g., "$${__value.raw}"
|
|
})))
|
|
|
|
# Optional: For Tempo, to link to a logging datasource like Loki.
|
|
traces_to_logs = optional(object({
|
|
target_datasource_name = string # The name of the target datasource (e.g., "loki-main")
|
|
query = string # The query to run in the target datasource.
|
|
custom_query = optional(bool)
|
|
filter_by_span_id = optional(bool)
|
|
filter_by_trace_id = optional(bool)
|
|
span_start_time_shift = optional(string)
|
|
span_end_time_shift = optional(string)
|
|
}))
|
|
}))
|
|
}
|
|
|
|
# Sensitive maps for URLs, usernames, passwords
|
|
variable "datasource_urls" {
|
|
description = "Map of datasource URLs, keyed by url_key"
|
|
type = map(string)
|
|
sensitive = true
|
|
}
|
|
|
|
variable "datasource_users" {
|
|
description = "Map of datasource usernames, keyed by user_key"
|
|
type = map(string)
|
|
sensitive = true
|
|
}
|
|
|
|
variable "datasource_passwords" {
|
|
description = "Map of datasource passwords, keyed by pass_key"
|
|
type = map(string)
|
|
sensitive = true
|
|
}
|