-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtask.tf
50 lines (46 loc) · 1.37 KB
/
task.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
resource "aws_ecs_task_definition" "task" {
family = "TSK-${var.projectName}"
container_definitions = jsonencode([
{
name = "${var.projectName}"
essential = true,
image = "${aws_ecr_repository.repository.repository_url}:latest",
command = ["-Dsonar.search.javaAdditionalOpts=-Dnode.store.allow_mmap=false"]
environment = [
{
name = "SONAR_JDBC_URL"
value = "jdbc:postgresql://${data.aws_db_instance.database.endpoint}/${aws_db_instance.rds.db_name}"
},
{
name = "SONAR_JDBC_USERNAME"
value = "${var.rdsUser}"
},
{
name = "SONAR_JDBC_PASSWORD"
value = "${var.rdsPass}"
}
]
logConfiguration = {
logDriver = "awslogs"
options = {
awslogs-group = "${aws_cloudwatch_log_group.cloudwatch-log-group.name}"
awslogs-region = "${var.regionDefault}"
awslogs-stream-prefix = "ecs"
}
}
portMappings = [
{
containerPort = 9000
hostPort = 9000
protocol = "tcp"
}
]
}
])
network_mode = "awsvpc"
requires_compatibilities = ["FARGATE"]
execution_role_arn = "arn:aws:iam::${var.AWSAccount}:role/ecsTaskExecutionRole"
memory = "4096"
cpu = "2048"
depends_on = [aws_db_instance.rds]
}