-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
57 lines (47 loc) · 1.19 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
}
module "managed_grafana" {
count = var.enable_managed_grafana ? 1 : 0
source = "terraform-aws-modules/managed-service-grafana/aws"
version = "~> 1.3"
# Workspace
name = local.name
stack_set_name = local.name
data_sources = ["PROMETHEUS"]
associate_license = false
tags = var.tags
}
provider "grafana" {
url = local.amg_ws_endpoint
auth = var.grafana_api_key
}
resource "grafana_data_source" "amp" {
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" {
title = "Observability Accelerator Dashboards"
}