File tree Expand file tree Collapse file tree 6 files changed +87
-18
lines changed
infrastructure/applications Expand file tree Collapse file tree 6 files changed +87
-18
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,17 @@ module "pycon_backend" {
3434 }
3535}
3636
37+ module "clamav" {
38+ source = " ./clamav"
39+ cluster_id = module. cluster . cluster_id
40+ logs_group_name = module. cluster . logs_group_name
41+
42+ providers = {
43+ aws = aws
44+ aws.us = aws.us
45+ }
46+ }
47+
3748# Other resources
3849
3950module "database" {
Original file line number Diff line number Diff line change 1+ resource "aws_ecs_task_definition" "clamav" {
2+ family = " pythonit-${ terraform . workspace } -clamav"
3+
4+ container_definitions = jsonencode ([
5+ {
6+ name = " clamav"
7+ image = " clamav/clamav-debian:1.4.1"
8+ memoryReservation = 1000
9+ essential = true
10+
11+ portMappings = [
12+ {
13+ containerPort = 3310
14+ hostPort = 3310
15+ },
16+ ]
17+
18+ mountPoints = []
19+
20+ logConfiguration = {
21+ logDriver = " awslogs"
22+ options = {
23+ " awslogs-group" = var.logs_group_name
24+ " awslogs-region" = " eu-central-1"
25+ " awslogs-stream-prefix" = " clamav"
26+ }
27+ }
28+
29+ healthCheck = {
30+ retries = 3
31+ command = [
32+ " CMD-SHELL" ,
33+ " echo 1"
34+ ]
35+ timeout = 3
36+ interval = 10
37+ }
38+
39+ stopTimeout = 300
40+ }
41+ ])
42+
43+ requires_compatibilities = []
44+ tags = {}
45+ }
46+
47+ resource "aws_ecs_service" "clamav" {
48+ name = " clamav"
49+ cluster = var. cluster_id
50+ task_definition = aws_ecs_task_definition. clamav . arn
51+ desired_count = 1
52+ deployment_minimum_healthy_percent = 0
53+ deployment_maximum_percent = 100
54+ }
Original file line number Diff line number Diff line change 1+ variable "cluster_id" {}
2+ variable "logs_group_name" {}
Original file line number Diff line number Diff line change @@ -41,6 +41,25 @@ resource "aws_security_group_rule" "out_redis" {
4141 security_group_id = aws_security_group. server . id
4242}
4343
44+ resource "aws_security_group_rule" "in_clamav" {
45+ type = " egress"
46+ from_port = 3310
47+ to_port = 3310
48+ protocol = " tcp"
49+ source_security_group_id = aws_security_group. server . id
50+ security_group_id = aws_security_group. server . id
51+ }
52+
53+ resource "aws_security_group_rule" "out_clamav" {
54+ # needed by fargate to connect to the server with clamav
55+ type = " ingress"
56+ from_port = 3310
57+ to_port = 3310
58+ protocol = " tcp"
59+ source_security_group_id = aws_security_group. server . id
60+ security_group_id = aws_security_group. server . id
61+ }
62+
4463resource "aws_security_group_rule" "web_http" {
4564 type = " ingress"
4665 from_port = 80
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ locals {
162162 },
163163 {
164164 name = " CLAMAV_HOST" ,
165- value = module.secrets.value.clamav_host
165+ value = var.server_ip
166166 },
167167 {
168168 name = " ECS_NETWORK_CONFIG" ,
You can’t perform that action at this time.
0 commit comments