variable "environment" {
  description = "Deployment environment name."
  type        = string

  validation {
    condition     = contains(["dev", "staging", "prod"], var.environment)
    error_message = "environment must be one of dev, staging, prod."
  }
}

variable "region" {
  description = "Primary region for the fictional examplecloud provider."
  type        = string
  default     = "eu-example-1"
}

variable "secondary_region" {
  type    = string
  default = "us-example-2"
}

variable "instance_count" {
  description = "Number of application instances."
  type        = number
  default     = 2

  validation {
    condition     = var.instance_count > 0 && var.instance_count <= 20
    error_message = "instance_count must be between 1 and 20."
  }
}

variable "instance_size" {
  type    = string
  default = "small"
}

variable "subnets" {
  description = "Subnet definitions keyed by name."
  type = map(object({
    cidr = string
    zone = string
    public = optional(bool, false)
  }))
  default = {
    app-a = { cidr = "10.20.1.0/24", zone = "a" }
    app-b = { cidr = "10.20.2.0/24", zone = "b" }
  }
}

variable "tags" {
  type    = map(string)
  default = {}
}

variable "admin_note" {
  description = "Free-form note. Marked sensitive to exercise sensitive-value handling; the default is not a secret."
  type        = string
  default     = "SAMPLE note, not a credential"
  sensitive   = true
  nullable    = false
}
