-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathprometheus-endpoint.tf
More file actions
42 lines (39 loc) · 1.22 KB
/
prometheus-endpoint.tf
File metadata and controls
42 lines (39 loc) · 1.22 KB
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
resource "aws_security_group" "prometheus_vpc_endpoint_sg" {
count = var.create_prometheus_vpc_endpoint ? 1 : 0
name_prefix = local.prometheus_sg_name
vpc_id = var.vpc_id
tags = merge(tomap({ "Name" = local.prometheus_sg_name }), var.tags)
ingress {
description = "VPC traffic"
from_port = 9090
to_port = 9090
protocol = "tcp"
cidr_blocks = [var.vpc_cidr_block]
}
ingress {
description = "VPC traffic"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = [var.vpc_cidr_block]
}
egress {
description = "VPC traffic"
from_port = 0
to_port = 65535
protocol = "tcp"
cidr_blocks = [var.vpc_cidr_block]
}
}
resource "aws_vpc_endpoint" "prometheus_endpoint" {
count = var.create_prometheus_vpc_endpoint ? 1 : 0
tags = merge(tomap({ "Name" = local.prometheus_endpoint }), var.tags)
vpc_id = var.vpc_id
service_name = "com.amazonaws.${data.aws_region.current.region}.aps"
vpc_endpoint_type = "Interface"
private_dns_enabled = true
security_group_ids = [
aws_security_group.prometheus_vpc_endpoint_sg[0].id
]
subnet_ids = var.private_subnet_ids
}