Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #21 from LF-Engineering/add-bugzilla-task-definition
Browse files Browse the repository at this point in the history
Add bugzilla task definition
  • Loading branch information
khalifapro authored Jan 25, 2022
2 parents b7c0160 + 0215361 commit a74cbe3
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 3 deletions.
48 changes: 47 additions & 1 deletion deploy/dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,37 @@ resource "aws_ecs_task_definition" "insights-connector-gerrit-task" {

}

/* ECS bugzilla connector task definition */
resource "aws_ecs_task_definition" "insights-connector-bugzilla-task" {
family = "insights-connector-bugzilla-task"
requires_compatibilities = ["FARGATE"]
network_mode = "awsvpc"
cpu = "256"
memory = "512"
execution_role_arn = aws_iam_role.ecs_task_execution_role.arn
task_role_arn = aws_iam_role.ecs_task_role.arn
container_definitions = jsonencode([
{
name = "insights-connector-bugzilla"
image = "395594542180.dkr.ecr.us-east-l.amazonaws.com/insights-connector-bugzilla:latest"
cpu = 128
memory = 512
essential = true
logConfiguration: {
"logDriver": "awslogs",
"options": {
"awslogs-group": "insights-ecs-bugzilla",
"awslogs-region": "us-east-2",
"awslogs-create-group": "true",
"awslogs-stream-prefix": "ecs"
}
}
}
])

}


resource "aws_security_group" "security_group" {
name = "example-task-security-group"
vpc_id = aws_vpc.main.id
Expand Down Expand Up @@ -252,6 +283,21 @@ resource "aws_ecs_service" "git" {

}

/* ecs bugzilla service */
resource "aws_ecs_service" "bugzilla" {
name = "insights-bugzilla"
cluster = aws_ecs_cluster.insights-git-cluster.id
task_definition = aws_ecs_task_definition.insights-connector-bugzilla-task.arn
desired_count = 1
launch_type = "FARGATE"
scheduling_strategy = "REPLICA"
network_configuration {
security_groups = [aws_security_group.security_group.id]
subnets = [aws_subnet.main.id]
assign_public_ip = true
}

}

/* iam roles */

Expand Down Expand Up @@ -317,4 +363,4 @@ resource "aws_iam_role_policy_attachment" "task_role_cloudwatch_policy_attachmen
resource "aws_iam_role_policy_attachment" "task_execution_role_cloudwatch_policy_attachment" {
role = aws_iam_role.ecs_task_execution_role.name
policy_arn = "arn:aws:iam::aws:policy/CloudWatchLogsFullAccess"
}
}
47 changes: 46 additions & 1 deletion deploy/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,35 @@ resource "aws_ecs_task_definition" "insights-connector-gerrit-task" {

}

/* ECS bugzilla connector task definition */
resource "aws_ecs_task_definition" "insights-connector-bugzilla-task" {
family = "insights-connector-bugzilla-task"
requires_compatibilities = ["FARGATE"]
network_mode = "awsvpc"
cpu = "256"
memory = "512"
execution_role_arn = aws_iam_role.ecs_task_execution_role.arn
task_role_arn = aws_iam_role.ecs_task_role.arn
container_definitions = jsonencode([
{
name = "insights-connector-bugzilla"
image = "844390194980.dkr.ecr.us-east-l.amazonaws.com/insights-connector-bugzilla:stable"
cpu = 128
memory = 512
essential = true
logConfiguration: {
"logDriver": "awslogs",
"options": {
"awslogs-group": "insights-connector-bugzilla-task",
"awslogs-region": var.eg_aws_region,
"awslogs-create-group": "true",
"awslogs-stream-prefix": "ecs"
}
}
}
])

}

resource "aws_security_group" "security_group" {
name = "example-task-security-group"
Expand Down Expand Up @@ -223,6 +252,22 @@ resource "aws_ecs_service" "git" {
}


/* ecs bugzilla service */
resource "aws_ecs_service" "bugzilla" {
name = "insights-bugzilla"
cluster = aws_ecs_cluster.insights-git-cluster.id
task_definition = aws_ecs_task_definition.insights-connector-bugzilla-task.arn
desired_count = 1
launch_type = "FARGATE"
scheduling_strategy = "REPLICA"
network_configuration {
security_groups = [aws_security_group.security_group.id]
subnets = [aws_subnet.main.id]
assign_public_ip = true
}

}

/* iam roles */

resource "aws_iam_role" "ecs_task_execution_role" {
Expand Down Expand Up @@ -287,4 +332,4 @@ resource "aws_iam_role_policy_attachment" "task_role_cloudwatch_policy_attachmen
resource "aws_iam_role_policy_attachment" "task_execution_role_cloudwatch_policy_attachment" {
role = aws_iam_role.ecs_task_execution_role.name
policy_arn = "arn:aws:iam::aws:policy/CloudWatchLogsFullAccess"
}
}
47 changes: 46 additions & 1 deletion deploy/test/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,35 @@ resource "aws_ecs_task_definition" "insights-connector-gerrit-task" {

}

/* ECS bugzilla connector task definition */
resource "aws_ecs_task_definition" "insights-connector-bugzilla-task" {
family = "insights-connector-bugzilla-task"
requires_compatibilities = ["FARGATE"]
network_mode = "awsvpc"
cpu = "256"
memory = "512"
execution_role_arn = aws_iam_role.ecs_task_execution_role.arn
task_role_arn = aws_iam_role.ecs_task_role.arn
container_definitions = jsonencode([
{
name = "insights-connector-bugzilla"
image = "726224182707.dkr.ecr.us-east-l.amazonaws.com/insights-connector-bugzilla:test"
cpu = 128
memory = 512
essential = true
logConfiguration: {
"logDriver": "awslogs",
"options": {
"awslogs-group": "insights-connector-bugzilla-task",
"awslogs-region": var.eg_aws_region,
"awslogs-create-group": "true",
"awslogs-stream-prefix": "ecs"
}
}
}
])

}

resource "aws_security_group" "security_group" {
name = "example-task-security-group"
Expand Down Expand Up @@ -222,6 +251,22 @@ resource "aws_ecs_service" "git" {

}

/* ecs bugzilla service */
resource "aws_ecs_service" "bugzilla" {
name = "insights-bugzilla"
cluster = aws_ecs_cluster.insights-git-cluster.id
task_definition = aws_ecs_task_definition.insights-connector-bugzilla-task.arn
desired_count = 1
launch_type = "FARGATE"
scheduling_strategy = "REPLICA"
network_configuration {
security_groups = [aws_security_group.security_group.id]
subnets = [aws_subnet.main.id]
assign_public_ip = true
}

}


/* iam roles */

Expand Down Expand Up @@ -287,4 +332,4 @@ resource "aws_iam_role_policy_attachment" "task_role_cloudwatch_policy_attachmen
resource "aws_iam_role_policy_attachment" "task_execution_role_cloudwatch_policy_attachment" {
role = aws_iam_role.ecs_task_execution_role.name
policy_arn = "arn:aws:iam::aws:policy/CloudWatchLogsFullAccess"
}
}

0 comments on commit a74cbe3

Please sign in to comment.