test
This commit is contained in:
@@ -37,17 +37,6 @@ resource "aws_ecs_task_definition" "integreat_background_worker" {
|
||||
task_role_arn = var.task_role_arn
|
||||
}
|
||||
|
||||
resource "aws_ecs_task_definition" "square_import_job" {
|
||||
|
||||
family = "square_import_job_${var.stage}"
|
||||
container_definitions = file("${var.stage}-square-import-job-taskdef.json")
|
||||
memory = 8192
|
||||
cpu = 2048
|
||||
network_mode = "awsvpc"
|
||||
requires_compatibilities = ["FARGATE"]
|
||||
execution_role_arn = var.execution_role_arn
|
||||
task_role_arn = var.task_role_arn
|
||||
}
|
||||
|
||||
resource "aws_ecs_service" "integreat_app" {
|
||||
name = "integreat_app_${var.stage}"
|
||||
@@ -334,3 +323,38 @@ resource "aws_service_discovery_service" "background_worker_service" {
|
||||
failure_threshold = 1
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_cloudwatch_event_rule" "square_import_job_schedule" {
|
||||
name = "square-import-job-schedule"
|
||||
schedule_expression = "rate(4 hours)"
|
||||
}
|
||||
|
||||
|
||||
resource "aws_cloudwatch_event_target" "square_import_job_target" {
|
||||
target_id = "square-import-job"
|
||||
arn = var.ecs_cluster
|
||||
rule = aws_cloudwatch_event_rule.square_import_job_schedule.name
|
||||
role_arn = var.execution_role_arn
|
||||
|
||||
ecs_target {
|
||||
task_count = 1
|
||||
task_definition_arn = aws_ecs_task_definition.integreat_background_worker.arn
|
||||
network_configuration {
|
||||
assign_public_ip = true
|
||||
security_groups = [ "sg-004e5855310c453a3", "sg-02d167406b1082698"]
|
||||
subnets = [ "subnet-5e675761", "subnet-8519fde2", "subnet-89bab8d4" ]
|
||||
}
|
||||
}
|
||||
|
||||
input = <<DOC
|
||||
{
|
||||
"containerOverrides": [
|
||||
{
|
||||
"name": "integreat-app",
|
||||
"environment": [{"name": "INTEGREAT_JOB", "value": "hello-world"},
|
||||
{"name": "DD_SERVICE", "value": "hello-world"}]
|
||||
}
|
||||
]
|
||||
}
|
||||
DOC
|
||||
}
|
||||
Reference in New Issue
Block a user