generated from cloudposse/terraform-example-module
-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.tf
59 lines (51 loc) · 1.37 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
locals {
key_prefix = join("/", compact([
trimprefix(trimsuffix(var.bucket_key_prefix, "/"), "/"),
module.volume_label.id
]))
}
module "volume_label" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.24.1"
name = var.volume_name
delimiter = "_"
label_order = ["name"]
}
# TODO: Support different user/groups
module "mobius3" {
source = "git::https://github.com/cloudposse/terraform-aws-ecs-container-definition.git?ref=tags/0.57.0"
container_name = "mobius3-${var.volume_name}"
container_image = var.mobius3_image
essential = true
user = var.user
command = [
"zmobius3",
"/srv/data",
var.bucket_id,
"https://{}.s3.${var.bucket_region}.amazonaws.com/",
var.bucket_region,
"--prefix", "${local.key_prefix}/",
"--credentials-source", "ecs-container-endpoint",
"--log-level", "INFO"
]
healthcheck = {
command = ["/bin/sh", "-c",
"cat /tmp/ruok | grep imok"
]
retries = 3
timeout = 3
interval = 10
startPeriod = 60
}
mount_points = [{
containerPath = "/srv/data"
sourceVolume = module.volume_label.id
readOnly = false
}]
log_configuration = var.log_configuration
}
locals {
output_container_depends_on = {
containerName = module.mobius3.json_map_object["name"]
condition = "HEALTHY"
}
}