variable "subscription_id" { description = "Subscription for the workspace and alerts, as a GUID. The diagnostic setting itself covers the whole tenant." type = string validation { condition = can(regex("^[0-9a-fA-F-]{36}$", var.subscription_id)) error_message = "Give the subscription ID as a GUID." } } variable "resource_group_name" { description = "An existing resource group for the workspace, alerts, and saved queries. Keep it apart from workloads." type = string } variable "alert_emails" { description = "Addresses that receive the alerts. Prefer an on-call address over a person." type = list(string) validation { condition = length(var.alert_emails) > 0 error_message = "Name at least one address, or the alerts have nowhere to go." } } variable "log_categories" { description = "Entra ID log categories copied to the workspace. AuditLogs and SignInLogs are required, because the alerts read them. Every category is billed by the gigabyte, so read a week of the workspace's Usage table before adding more, such as NonInteractiveUserSignInLogs." type = list(string) default = ["AuditLogs", "SignInLogs", "ServicePrincipalSignInLogs", "ManagedIdentitySignInLogs"] validation { condition = contains(var.log_categories, "AuditLogs") && contains(var.log_categories, "SignInLogs") error_message = "Keep AuditLogs and SignInLogs; the alerts read them." } validation { condition = alltrue([for c in var.log_categories : contains([ "AuditLogs", "SignInLogs", "NonInteractiveUserSignInLogs", "ServicePrincipalSignInLogs", "ManagedIdentitySignInLogs", "ProvisioningLogs", "ADFSSignInLogs", "RiskyUsers", "UserRiskEvents", "RiskyServicePrincipals", "ServicePrincipalRiskEvents", "MicrosoftGraphActivityLogs", ], c)]) error_message = "Use category names from Microsoft's list, such as AuditLogs or NonInteractiveUserSignInLogs." } } variable "expected_actors" { description = "Who makes role, app, and sign-in policy changes as part of their job, such as the deployment pipeline: a person's UPN, or an app's application ID. Their changes do not alert, and the workspace still records them. Every entry is a blind spot, so keep it short." type = list(string) default = [] } variable "break_glass_object_ids" { description = "Object IDs of the emergency access accounts. Any sign-in by one alerts, as Microsoft's emergency access guidance recommends. Exporting NonInteractiveUserSignInLogs as well catches token refreshes." type = list(string) default = [] validation { condition = alltrue([for id in var.break_glass_object_ids : can(regex("^[0-9a-fA-F-]{36}$", id))]) error_message = "Give each account's object ID as a GUID." } } variable "risky_sign_in_alerts" { description = "Alert on sign-ins Entra ID rates high risk. The risk columns are filled only with Microsoft Entra ID P2; without it they read hidden and this alert never fires." type = bool default = false } variable "silence_minutes" { description = "Minutes with no interactive sign-ins before the silence alert fires. A small tenant may be quiet overnight and need more." type = number default = 60 validation { condition = contains([60, 120, 180, 360, 720], var.silence_minutes) error_message = "Use 60, 120, 180, 360, or 720." } } variable "retention_days" { description = "How long the workspace keeps the audit and sign-in logs." type = number default = 365 validation { condition = var.retention_days >= 90 && var.retention_days <= 730 error_message = "Keep at least 90 days, and Azure allows up to 730." } } 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 = {} }