# locals =====================================================================

locals {
  tags = merge(
    {
      ManagedBy = "terraform"
      Module    = "storage/fsx-windows"
    },
    var.tags,
  )

  # MULTI_AZ_1 requires preferred_subnet_id — derive from first subnet if not explicit.
  preferred_subnet_id = var.deployment_type == "MULTI_AZ_1" ? coalesce(
    var.preferred_subnet_id,
    var.subnet_ids[0],
  ) : null

  # Audit logging is only configured when a destination ARN is provided.
  audit_log_enabled = var.audit_log_destination_arn != null
}
