-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
56 lines (45 loc) · 1.16 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
data "docker_registry_image" "timemachine" {
name = "odarriba/timemachine:latest"
}
resource "docker_image" "timemachine" {
name = data.docker_registry_image.timemachine.name
pull_triggers = [data.docker_registry_image.timemachine.sha256_digest]
}
resource "docker_container" "timemachine" {
name = "timemachine"
image = docker_image.timemachine.image_id
volumes {
host_path = "/mnt/xwing/data/timemachine"
container_path = "/timemachine"
}
ports {
internal = 548
external = 548
ip = var.ips["eth0"]
}
ports {
internal = 636
external = 636
ip = var.ips["eth0"]
}
upload {
content = data.template_file.timemachine-entrypoint.rendered
file = "/entrypoint-custom.sh"
}
entrypoint = [
"/bin/sh",
"/entrypoint-custom.sh",
]
restart = "unless-stopped"
destroy_grace_seconds = 10
must_run = true
}
data "template_file" "timemachine-entrypoint" {
template = file("${path.module}/entrypoint.sh.tpl")
vars = {
username-1 = var.username-1
password-1 = var.password-1
username-2 = var.username-2
password-2 = var.password-2
}
}