variable "name" { description = "Base name for the trail and bucket." type = string default = "audit-log-immutable" 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 "retention_days" { description = "Object Lock default retention. Set this to at least your longest expected dwell time." type = number default = 400 validation { condition = var.retention_days >= 90 error_message = "retention_days must be 90 or more. Shorter than that, the log expires before most investigations start." } } variable "lock_mode" { description = "GOVERNANCE allows bypass by a principal with s3:BypassGovernanceRetention. COMPLIANCE allows no bypass, including by the root user, for the full retention period." type = string default = "GOVERNANCE" validation { condition = contains(["GOVERNANCE", "COMPLIANCE"], var.lock_mode) error_message = "lock_mode must be GOVERNANCE or COMPLIANCE." } } variable "organization_trail" { description = "Create an organization trail covering every member account. Requires the management or delegated administrator account with CloudTrail trusted access enabled." type = bool default = false } variable "cloudwatch_logs" { description = "Also deliver events to CloudWatch Logs so metric filters and alarms can run against them." type = bool default = true } variable "cloudwatch_retention_days" { description = "CloudWatch Logs retention. The S3 copy is the system of record, so this is the alerting window." type = number default = 90 } 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 = {} } variable "terraform_role_name" { description = "IAM role name that Terraform assumes. When set, the bucket policy denies lock, lifecycle, and versioning changes to every other principal. Leave empty to skip that statement, which you should do on the first apply and then set." type = string default = "" }