-
Notifications
You must be signed in to change notification settings - Fork 17
/
film-ratings-db-task-definition.tf
58 lines (57 loc) · 1.29 KB
/
film-ratings-db-task-definition.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
data "aws_ecs_task_definition" "film_ratings_db" {
task_definition = "${aws_ecs_task_definition.film_ratings_db.family}"
depends_on = ["aws_ecs_task_definition.film_ratings_db"]
}
resource "aws_ecs_task_definition" "film_ratings_db" {
family = "film_ratings_db"
volume {
name = "filmdbvolume"
host_path = "/mnt/efs/postgres"
}
network_mode = "awsvpc"
container_definitions = <<DEFINITION
[
{
"name": "film_ratings_db",
"image": "postgres:alpine",
"essential": true,
"portMappings": [
{
"containerPort": 5432
}
],
"environment": [
{
"name": "POSTGRES_DB",
"value": "filmdb"
},
{
"name": "POSTGRES_USER",
"value": "filmuser"
},
{
"name": "POSTGRES_PASSWORD",
"value": "${var.db_password}"
}
],
"mountPoints": [
{
"readOnly": null,
"containerPath": "/var/lib/postgresql/data",
"sourceVolume": "filmdbvolume"
}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "film_ratings_db",
"awslogs-region": "${var.region}",
"awslogs-stream-prefix": "ecs"
}
},
"memory": 512,
"cpu": 256
}
]
DEFINITION
}