variable "name" { description = "Base name for the alarms, the read trail, and its bucket." type = string default = "insider-data-theft" validation { condition = can(regex("^[a-z0-9-]{3,40}$", var.name)) error_message = "name must be 3-40 characters of lowercase letters, digits, or hyphens." } } variable "trail_log_group" { description = "CloudWatch log group a multi-region CloudTrail trail delivers management events to, such as the Standard audit log template builds." type = string } variable "expected_principal_arns" { description = "IAM role ARNs for roles that change bucket policies, key policies, and trails as part of their job, such as the deployment pipeline. Their changes do not alarm. Keep this list short: every entry is a blind spot." type = list(string) default = [] validation { condition = length(var.expected_principal_arns) <= 4 error_message = "List at most four. Each adds to a filter pattern that CloudWatch caps at 1,024 characters." } validation { condition = alltrue([for a in var.expected_principal_arns : can(regex("^arn:aws[a-z-]*:iam::[0-9]{12}:role/", a))]) error_message = "Each entry must be an IAM role ARN, such as arn:aws:iam::123456789012:role/deployer." } } variable "sensitive_bucket_arns" { description = "Buckets whose reads are recorded object by object, so bulk downloads can be seen. Leave empty to skip the read trail." type = list(string) default = [] validation { condition = alltrue([for b in var.sensitive_bucket_arns : can(regex("^arn:aws[a-z-]*:s3:::[a-z0-9.-]+$", b))]) error_message = "Each entry must be a bucket ARN, such as arn:aws:s3:::payroll-exports, with no path." } } variable "bulk_read_threshold" { description = "Objects one principal may read from the sensitive buckets in five minutes before the alarm fires. Set it from a week of normal use; the default is a starting point." type = number default = 1000 } variable "read_log_retention_days" { description = "How long object-level read records are kept, in the bucket and in CloudWatch Logs." type = number default = 90 } variable "alert_topic_arn" { description = "An existing SNS topic for the alarms. If it is encrypted, its key policy must let cloudwatch.amazonaws.com use the key, or the alarms cannot publish. Leave empty to create one and subscribe alert_emails." type = string default = "" } variable "alert_emails" { description = "Addresses subscribed to a new topic, when alert_topic_arn is empty." type = list(string) default = [] } variable "owner" { description = "Tag contract: accountable team." type = string default = "security-engineering" } variable "environment" { description = "Tag contract: environment." type = string default = "prod" } variable "extra_tags" { description = "Additional tags merged over the contract." type = map(string) default = {} }