-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
33 lines (29 loc) · 833 Bytes
/
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
resource "null_resource" "dockervol" {
provisioner "local-exec" {
command = "mkdir noderedvol/ || true && sudo chown -R 1000:1000 noderedvol/"
}
}
module "image"{
source = "./image"
image_in = var.image[terraform.workspace]
}
resource "random_string" "random" {
count = local.container_count
length = 4
special = false
upper = false
}
resource "docker_container" "nodered_container" {
depends_on = [null_resource.dockervol]
name = join("-",["nodered", terraform.workspace, random_string.random[count.index].result])
count = local.container_count
image = module.image.image_out
ports {
internal = var.int_port[terraform.workspace][count.index]
external = var.ext_port[terraform.workspace][count.index]
}
volumes {
container_path = "/data"
host_path = "${path.cwd}/noderedvol"
}
}