-
Notifications
You must be signed in to change notification settings - Fork 45
/
managed_grafana.tf
49 lines (40 loc) · 1.29 KB
/
managed_grafana.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
resource "aws_grafana_workspace" "grafana" {
count = var.enable_managed_prometheus ? 1 : 0
account_access_type = var.managed_prometheus_access_type
authentication_providers = var.managed_grafana_authentication_providers
permission_type = var.managed_grafana_permission_type
role_arn = aws_iam_role.grafana[count.index].arn
data_sources = var.managed_grafana_datasources
notification_destinations = var.managed_grafana_notification_destinations
vpc_configuration {
subnet_ids = [
aws_subnet.private_subnet_1a.id,
aws_subnet.private_subnet_1b.id,
aws_subnet.private_subnet_1c.id
]
security_group_ids = [
aws_security_group.cluster_nodes_sg.id
]
}
}
resource "aws_iam_role" "grafana" {
count = var.enable_managed_prometheus ? 1 : 0
name = format("%s-managed-grafana", var.cluster_name)
assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = "sts:AssumeRole"
Effect = "Allow"
Sid = ""
Principal = {
Service = "grafana.amazonaws.com"
}
},
]
})
}
# resource "aws_grafana_role_association" "grafana" {
# user_ids = ["USER_ID_1", "USER_ID_2"]
# workspace_id = aws_grafana_workspace.grafana.id
# }