# General settings
variable "environment" {
  description = "Name of environment, e.g. dev, sandbox, qa, prod"
  default     = "dev"
}

variable "service_name" {
  description = "Name of service"
  default     = "neo4j"
}

variable "aws_region" {
  description = "Name of AWS region for resources"
  default     = "us-east-1"
}

variable "vpc_id" {
  description = "ID of existing vpc"
  default     = "vpc-34dbfd51"
}

variable "ami_id" {
  description = "AMI ID for Neo4j ASG"
  default     = null
}

variable "aws_instance_type" {
  description = "AWS instance type"
  default     = "t3.medium"
}

variable "ssh_keypair_name" {
  description = "Name of existing AWS SSH keypair"
  default     = "dev_orchard_admin"
}

variable "user_data" {
  description = "User data script"
  default     = "echo 'hello'"
}

variable "backup_port" {
  type        = number
  description = "Backup port"
  default     = 6362
}

variable "bolt_port" {
  type        = number
  description = "Bolt port"
  default     = 7687
}

variable "backup_ingress_security_group_id" {
  description = "CIDR blocks from which to allow backup traffic"
  type        = string
  default     = ""
}

variable "bolt_ingress_cidr_blocks" {
  description = "CIDR blocks from which to allow Bolt traffic"
  type        = list(string)

  default = [
    "10.10.40.0/22",
    "10.40.0.0/22",
    "192.168.31.0/24",
  ]
}

variable "neo4j_clustering_ports" {
  description = "Ports used by Neo4j clustering. Should typically only be accessible from inside cluster group"
  type        = list(number)

  default = [
    5000,
    6000,
    7000,
    7688,
  ]
}

variable "ssh_port" {
  type        = number
  description = "SSH port"
  default     = 22
}

variable "ssh_ingress_cidr_blocks" {
  description = "CIDR blocks from which to allow SSH"
  type        = list(string)

  default = [
    "10.10.141.0/29",
    "10.140.0.0/29",
    "10.30.0.0/22",
    "10.40.0.0/22",
    "192.168.32.0/24",
    "192.168.33.0/24",
    "192.168.40.0/22",
  ]
}

variable "allow_backups" {
  type        = string
  description = "Whether or not backup port should be opened"
  default     = false
}

variable "allow_bolt" {
  type        = string
  description = "Whether or not bolt port should be opened"
  default     = true
}

variable "root_volume_delete_on_termination" {
  description = "Root EBS volume delete_on_termination"
  default     = true
}

variable "root_volume_iops" {
  description = "Root EBS volume iops"
  default     = "3000"
}

variable "root_volume_size" {
  description = "Root EBS volume size"
  default     = "250"
}

variable "root_volume_type" {
  description = "Root EBS volume type"
  default     = "gp3"
}

variable "root_volume_throughput" {
  description = "Root EBS volume throughput"
  default     = "250"
}

variable "data_volume_device_name" {
  description = "Data EBS volume name as presented to the instance"
  default     = "/dev/sdb"
}

variable "data_volume_device_type" {
  description = "Data volume EBS volume type"
  default     = "gp3"
}

variable "data_volume_size" {
  description = "Data EBS volume size"
  default     = "100"
}

variable "data_volume_iops" {
  description = "Data EBS volume IOPS. Min 100, Max 64000. Up to 50 IOPS/GiB."
  default     = "1000"
}

variable "data_volume_throughput" {
  description = "Data EBS volume throughput. Min 125, Max 1000. Iops must be min 4x throughput"
  default     = "125"
}

variable "data_volume_delete_on_termination" {
  description = "Whether to delete data EBS volume on instance termination"
  default     = false
}

# Autoscaling group settings
variable "min_size" {
  type        = number
  description = "Minimum size for autoscaling group"
  default     = 3
}

variable "max_size" {
  type        = number
  description = "Maximum size for autoscaling group"
  default     = 5
}

variable "desired_capacity" {
  type        = number
  description = "Desired capacity for autoscaling group. Should typically match minimum"
  default     = 3
}

variable "default_cooldown" {
  type        = number
  description = "Default cooldown period between scaling activities in seconds"
  default     = 300
}

variable "health_check_grace_period" {
  type        = number
  description = "Grace period before health checks begin, in seconds"
  default     = 300
}

variable "wait_for_capacity_timeout" {
  type        = string
  description = "Grace period before health checks begin, in number + unit format, e.g. 10m"
  default     = "10m"
}

variable "vpc_private_subnet_ids" {
  description = "Subnets in which to run instances"
  type        = list(string)

  default = [
    "subnet-44c19a21",
    "subnet-b649dfef",
  ]
}

variable "availability_zone_distribution" {
  description = "The instance capacity distribution across availability zones"
  default     = "balanced-only"
}

variable "enabled_metrics" {
  description = "Enabled metrics for ASG"
  type        = list(string)
  default     = [
    "GroupMinSize",
    "GroupMaxSize",
    "GroupDesiredCapacity",
    "GroupInServiceInstances",
    "GroupPendingInstances",
    "GroupStandbyInstances",
    "GroupTerminatingInstances",
    "GroupTotalInstances",
  ]
}

variable "protect_from_scale_in" {
  description = "Protects instances for termination during scale in event"
  default     = true
}

variable "route53_zone_id" {
  description = "AWS Route 53 zone id"
  default     = "Z21XEY26C989RH"
}

variable "dbms_backup_s3_bucket" {
  type        = string
  description = "Name of existing bucket to pull initial dbms (users/roles) backup"
  default     = "dev-orchdbucket"
}
