-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
79 lines (66 loc) · 1.51 KB
/
main.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
provider "docker" {
host = "http://127.0.0.1:2375"
}
resource "docker_network" "private_network" {
name = "tick"
}
resource "docker_container" "influxdb" {
name = "influxdb"
image = "influxdb:latest"
restart = "always"
networks_advanced {
name = "${docker_network.private_network.id}"
}
ports {
internal = 8086
external = 8086
}
}
resource "docker_container" "chronograf" {
name = "chronograf"
image = "chronograf:latest"
restart = "always"
networks_advanced {
name = "${docker_network.private_network.id}"
}
ports {
internal = 8888
external = 8888
}
command = ["chronograf", "--influxdb-url=http://influxdb:8086", "--kapacitor-url=http://kapacitor:9092"]
depends_on = [docker_container.influxdb]
}
resource "docker_container" "kapacitor" {
name = "kapacitor"
image = "kapacitor:latest"
restart = "always"
networks_advanced {
name = "${docker_network.private_network.id}"
}
ports {
internal = 9092
external = 9092
}
}
resource "docker_container" "telegraf" {
name = "telegraf"
image = "telegraf:latest"
restart = "always"
networks_advanced {
name = "${docker_network.private_network.id}"
}
upload {
content = "${file(local.config)}"
file = "/etc/telegraf/telegraf.conf"
}
volumes {
host_path = "/var/run/docker.sock"
container_path = "/var/run/docker.sock"
}
}
####
#### This has to be your absolute path ####
####
locals {
config = "./tf-tick-stack/config/telegraf.conf"
}