variable "chef_version" {
  description = "Version of Chef Client"
  default     = "18.8.11"
}

variable "chef_server" {
  description = "Name of Chef server"
  default     = "shared-chef-server"
}

variable "chef_server_url" {
  description = "URL of Chef server"
  default     = "https://chef.theorchard.io/organizations/orchard"
}

variable "chef_environment" {
  description = "Chef environment"
  default     = "_default"
}

variable "chef_role" {
  description = "Chef role"
  default     = ""
}

variable "aws_instance_name" {
  description = "EC2 instance name"
  default     = ""
}

variable "aws_iam_role_id" {
  description = "Id of IAM role for instances under auto scaling group"
  default     = ""
}

variable "s3_chef_bucket" {
  description = "S3 bucket with Chef validator key"
  default     = "shared-chef-server-secrets"
}

variable "log_file" {
  description = "Log file for Chef bootstrap"
  default     = "/var/log/cinc/bootstrap.log"
}

variable "encrypted_data_bag_secret" {
  description = "Encrypted data bag secret file name"
  default     = "encrypted_data_bag_secret"
}

variable "qualys_encrypted_data_bag_secret" {
  description = "Qualys encrypted data bag secret file name"
  default     = "qualys_encrypted_data_bag_secret"
}

variable "ssl_verify_mode" {
  description = "The value of the ssl_verify_mode setting in the Chef client.rb configuration"
  default     = "verify_peer"
}

variable "node_attributes" {
  description = "An optional map of node-specific Chef attributes. These will be given normal precedence."
  default     = {}
}

variable "ebs_data_mount_point" {
  description = "Mount point for additional EBS data volume (empty string to skip)"
  type        = string
  default     = ""
  validation {
    condition     = var.ebs_data_mount_point == "" || (startswith(var.ebs_data_mount_point, "/") && length(regexall("\\s", var.ebs_data_mount_point)) == 0)
    error_message = "ebs_data_mount_point must be empty (to skip) or an absolute path starting with '/' and contain no whitespace."
  }
}

variable "instance_store_mount_point" {
  description = "Mount point for instance store (local NVMe) volume (empty string to skip)"
  type        = string
  default     = ""
  validation {
    condition     = var.instance_store_mount_point == "" || (startswith(var.instance_store_mount_point, "/") && length(regexall("\\s", var.instance_store_mount_point)) == 0)
    error_message = "instance_store_mount_point must be empty (to skip) or an absolute path starting with '/' and contain no whitespace."
  }
}

variable "block_device_filesystem_type" {
  description = "Filesystem type for block devices (e.g., ext4, xfs)"
  type        = string
  default     = "ext4"

  validation {
    condition     = contains(["ext4", "xfs"], var.block_device_filesystem_type)
    error_message = "block_device_filesystem_type must be one of: ext4, xfs."
  }
}
