Files
terraform-aws-observability…/main.tf
T
Vijay Chintalapati caeebe0e1a Make creation of Grafana Data Source and Folder configurable (#145)
* Made the cluster variable visible in dashboards

* Made the repo reusable with multiple EKS clusters

* Relabled the input variable from create_grafana_data_source to create_prometheus_data_source
2023-04-06 11:04:29 +02:00

46 lines
998 B
Terraform

resource "aws_prometheus_workspace" "this" {
count = var.enable_managed_prometheus ? 1 : 0
alias = local.name
tags = var.tags
}
resource "aws_prometheus_alert_manager_definition" "this" {
count = var.enable_alertmanager ? 1 : 0
workspace_id = local.amp_ws_id
definition = <<EOF
alertmanager_config: |
route:
receiver: 'default'
receivers:
- name: 'default'
EOF
}
provider "grafana" {
url = local.amg_ws_endpoint
auth = var.grafana_api_key
}
resource "grafana_data_source" "amp" {
count = var.create_prometheus_data_source ? 1 : 0
type = "prometheus"
name = local.name
is_default = true
url = local.amp_ws_endpoint
json_data {
http_method = "GET"
sigv4_auth = true
sigv4_auth_type = "workspace-iam-role"
sigv4_region = local.amp_ws_region
}
}
# dashboards
resource "grafana_folder" "this" {
count = var.create_dashboard_folder ? 1 : 0
title = "Observability Accelerator Dashboards"
}