-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.tf
50 lines (42 loc) · 1.24 KB
/
app.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
locals {
// Save the Prometheus Rules YAML file under the same path where the TF files are present
config = templatefile("prometheus_rules.yml", {})
yaml = yamldecode(local.config)
json = jsonencode(local.yaml)
}
resource "cloudfoundry_app" "appname" {
name = "tf-${var.postfix}"
space = var.cf_space_id
memory = var.memory
disk_quota = var.disk
docker_image = "provide the docker path"
docker_credentials = {
username = var.docker_username
password = var.docker_password
}
labels = {
"variant.tva/exporter" = true,
"variant.tva/rules" = false,
}
annotations = {
"prometheus.exporter.port" = "8001"
"prometheus.exporter.path" = "/metrics"
"prometheus.rules.json" = local.json
}
routes {
route = cloudfoundry_route.directory_service_internal.id
}
routes {
route = cloudfoundry_route.public.id
}
}
resource "cloudfoundry_route" "directory_service_internal" {
domain = data.cloudfoundry_domain.apps_internal_domain.id
space = var.cf_space_id
hostname = "thanos-query-${var.postfix}"
}
resource "cloudfoundry_route" "public" {
domain = data.cloudfoundry_domain.domain.id
space = var.cf_space_id
hostname = "thanos-query-${var.postfix}"
}