-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.tf
58 lines (54 loc) · 1.62 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
resource "aws_ecs_cluster" "default" {
name = "${var.project_name}-${var.stack_name}"
}
resource "aws_ecs_task_definition" "default" {
family = "${var.project_name}-agent-${var.stack_name}"
container_definitions = <<DEFINITION
[
{
"volumesFrom": [],
"cpu": ${var.ecs_task_cpu},
"memory": ${var.ecs_task_memory},
"extraHosts": null,
"dnsServers": null,
"disableNetworking": null,
"dnsSearchDomains": null,
"portMappings": [],
"hostname": null,
"essential": true,
"entryPoint": null,
"mountPoints": [],
"name": "${var.project_name}-${var.stack_name}-${replace(var.app_version,".","-")}",
"ulimits": null,
"dockerSecurityOptions": null,
"environment": [],
"links": null,
"workingDirectory": null,
"readonlyRootFilesystem": null,
"image": "${var.app_image}:${var.app_version}",
"command": null,
"user": null,
"dockerLabels": null,
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/aws/ecs/${var.project_name}-agent-${var.stack_name}",
"awslogs-region": "${var.aws_region}",
"awslogs-stream-prefix": "${var.project_name}"
}
},
"privileged": null,
"memoryReservation": null
}
]
DEFINITION
}
resource "aws_cloudwatch_log_group" "default" {
name = "/aws/ecs/${var.project_name}-agent-${var.stack_name}"
retention_in_days = "${var.log_retention}"
tags {
Terraform = "true"
Environment = "${var.stack_name}"
Application = "${var.project_name}"
}
}