-
Notifications
You must be signed in to change notification settings - Fork 16
/
subnet-exporter.tf
86 lines (73 loc) · 2.01 KB
/
subnet-exporter.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
resource "helm_release" "subnet_exporter" {
count = var.enable_subnet_exporter ? 1 : 0
name = "subnet-exporter"
namespace = kubernetes_namespace.monitoring.id
chart = "aws-subnet-exporter"
version = "0.1.5"
repository = "https://ministryofjustice.github.io/cloud-platform-helm-charts/"
set {
name = "image.tag"
value = var.aws_subnet_exporter_image_tag
}
set {
name = "awsSubnetExporter.region"
value = "eu-west-2"
}
set {
name = "awsSubnetExporter.filter"
value = "*"
}
set {
name = "serviceAccount.create"
value = false
}
set {
name = "serviceAccount.name"
value = local.subnet_exporter_sa
}
set {
name = "serviceMonitor.enabled"
value = true
}
depends_on = [
local.prometheus_dependency,
]
lifecycle {
ignore_changes = [keyring]
}
}
data "aws_iam_policy_document" "subnet_exporter" {
statement {
sid = "AllowDescribeSubnets"
effect = "Allow"
actions = [
"ec2:DescribeSubnets",
"ec2:DescribeTags",
]
resources = [
"*",
]
}
}
resource "aws_iam_policy" "subnet_exporter" {
count = var.enable_subnet_exporter ? 1 : 0
name_prefix = "subnet_exporter"
description = "AWS subnet exporter policy for cluster ${var.cluster_domain_name}"
policy = data.aws_iam_policy_document.subnet_exporter.json
}
module "subnet_exporter_irsa" {
count = var.enable_subnet_exporter ? 1 : 0
source = "github.com/ministryofjustice/cloud-platform-terraform-irsa?ref=2.0.0"
eks_cluster_name = terraform.workspace
namespace = kubernetes_namespace.monitoring.id
role_policy_arns = {
irsa = aws_iam_policy.subnet_exporter[0].arn
}
service_account_name = local.subnet_exporter_sa
business_unit = var.business_unit
application = var.application
is_production = var.is_production
team_name = var.team_name
environment_name = var.environment
infrastructure_support = var.infrastructure_support
}