-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy paththanos_query.tf
57 lines (50 loc) · 1.77 KB
/
thanos_query.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
locals {
thanos_query_routes = var.thanos_public_endpoints ? [cloudfoundry_route.thanos_query.id, cloudfoundry_route.thanos_query_internal.id] : [cloudfoundry_route.thanos_query_internal.id]
}
resource "cloudfoundry_app" "thanos_query" {
name = "tf-thanos-query-${local.postfix}"
space = var.cf_space_id
memory = var.thanos_query_memory
disk_quota = 2048
docker_image = var.thanos_query_image
docker_credentials = {
username = var.docker_username
password = var.docker_password
}
environment = var.environment
command = "/sidecars/bin/thanos query --grpc-address=0.0.0.0:10901 --http-address=0.0.0.0:9090 --store=${cloudfoundry_route.thanos_internal.endpoint}:19090 --store=${cloudfoundry_route.thanos_store_internal.endpoint}:19090"
dynamic "routes" {
for_each = local.thanos_query_routes
content {
route = routes.value
}
}
dynamic "service_binding" {
for_each = var.thanos_query_service_bindings
content {
service_instance = service_binding.value.service_instance
}
}
}
resource "cloudfoundry_route" "thanos_query" {
domain = data.cloudfoundry_domain.app_domain.id
space = var.cf_space_id
hostname = "thanos-query-${local.postfix}"
}
resource "cloudfoundry_route" "thanos_query_internal" {
domain = data.cloudfoundry_domain.apps_internal_domain.id
space = var.cf_space_id
hostname = "thanos-query-${local.postfix}"
}
resource "cloudfoundry_network_policy" "thanos_query" {
policy {
source_app = cloudfoundry_app.thanos_query.id
destination_app = cloudfoundry_app.thanos.id
port = "19090"
}
policy {
source_app = cloudfoundry_app.thanos_query.id
destination_app = cloudfoundry_app.thanos_store.id
port = "19090"
}
}