carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1variable "name" {
2 description = "Name for the instance, its security group, its IAM role and its instance profile (e.g. \"carlos-flagship-scanner\")."
3 type = string
4}
5
6variable "ami_id" {
7 description = "Debian arm64 AMI. Pass the console box's own image, module.<host>.ami_id, so the two are built from the same base. Ignored after creation: a newer image never replaces the box by itself."
8 type = string
9}
10
11variable "client_security_group_id" {
12 description = "Security group of the ONE box allowed to reach clamd: the console's. clamd has no authentication at all, so this group is the whole fence. The scanner's own group is created in this group's VPC."
13 type = string
14}
15
16variable "region" {
17 description = "AWS region the box runs in (e.g. \"eu-west-1\"). The SSM agent package is served per region and the box must fetch its own."
18 type = string
19}
20
21variable "instance_type" {
22 description = "EC2 instance type (arm64 Graviton). clamd holds about 1.5 GB of signatures resident and briefly about twice that while reloading them, so t4g.medium is the default. A t4g.small works only with concurrent_database_reload = false."
23 type = string
24 default = "t4g.medium"
25}
26
27variable "stream_max_bytes" {
28 description = "Largest object clamd accepts on a stream (StreamMaxLength), in bytes. Set the console's CARLOS_CLAMD_MAX_BYTES to this module's stream_max_bytes output: the two must be equal. Between 8 MiB and 100 MiB: the box's self-test streams fixtures of about 5 MB, and a whole stream must fit the 100 MiB scan budget."
29 type = number
30 default = 26214400
31 validation {
32 condition = var.stream_max_bytes >= 8388608 && var.stream_max_bytes <= 104857600
33 error_message = "stream_max_bytes must be between 8388608 (8 MiB) and 104857600 (100 MiB)."
34 }
35 validation {
36 condition = var.stream_max_bytes % 1048576 == 0
37 error_message = "stream_max_bytes must be a whole number of MiB (a multiple of 1048576), because clamd.conf holds it in M."
38 }
39}
40
41variable "memory_max" {
42 description = "clamd's cgroup ceiling (systemd MemoryMax). Under memory pressure the kernel kills clamd, never the SSM agent that is the only way onto the box."
43 type = string
44 default = "3G"
45}
46
47variable "memory_high" {
48 description = "clamd's throttle point (systemd MemoryHigh), about 85% of memory_max."
49 type = string
50 default = "2560M"
51}
52
53variable "concurrent_database_reload" {
54 description = "Keep scanning while freshclam's new signatures load, at the cost of holding both databases in memory at once. False pauses scanning during each reload and fits a smaller box."
55 type = bool
56 default = true
57}
58
59variable "subnet_id" {
60 description = "Subnet to launch in. Null (the default) is the default subnet of the default VPC, and is refused unless the client security group lives in the default VPC. The subnet needs a route to the internet: the box fetches signatures and packages."
61 type = string
62 default = null
63}
64