-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.tf
36 lines (30 loc) · 1011 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
34
35
36
resource "aws_ecs_cluster" "this" {
name = "${var.ecs_cluster_name}"
}
resource "aws_ecs_service" "this" {
name = "${var.ecs_service_name}"
cluster = "${aws_ecs_cluster.this.arn}"
task_definition = "${aws_ecs_task_definition.this.arn}"
scheduling_strategy = "DAEMON"
desired_count = 1
deployment_maximum_percent = 100
deployment_minimum_healthy_percent = 0
}
resource "aws_ecs_task_definition" "this" {
family = "openvpn"
container_definitions = "${data.template_file.ecs_task_def.rendered}"
volume {
name = "openvpn-data"
host_path = "${var.ecs_volume_data}"
}
volume {
name = "openvpn-conf"
host_path = "${var.ecs_volume_conf}"
}
}
data "template_file" "ecs_task_def" {
template = "${file("${path.module}/templates/task-def.json")}"
vars {
hash = "${md5(data.template_file.openvpn_server.rendered)}"
}
}