# 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"
}

# Security group settings
variable "allow_backups" {
  type        = string
  description = "Whether or not backup port should be opened"
  default     = true
}

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

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

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

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

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

variable "http_port" {
  type        = number
  description = "HTTP port"
  default     = 7474
}

variable "https_port" {
  type        = number
  description = "HTTPS port"
  default     = 7473
}

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

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",
    "192.168.32.0/24",
    "192.168.33.0/24",
  ]
}

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

  default = [
    "10.10.141.0/29",
    "10.140.0.0/29",
  ]
}

variable "http_ingress_cidr_blocks" {
  description = "CIDR blocks from which to allow HTTP"
  type        = list(string)
  default     = []
}

variable "https_ingress_cidr_blocks" {
  description = "CIDR blocks from which to allow HTTPS"
  type        = list(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,
  ]
}

# IAM settings
variable "iam_policy_file_enabled" {
  description = "Does this function require additional IAM policies? If so set this to true and add a file in ./policies/var.service_name.json"
  default     = false
}

# Launch configuration/instance settings
variable "aws_instance_type" {
  description = "AWS instance type"
  default     = "t3.medium"
}

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

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

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_delete_on_termination" {
  description = "Whether to delete data EBS volume on instance termination"
  default     = false
}

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'"
}

# 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 "enabled_metrics" {
  description = "Enabled metrics for ASG"
  type        = list(string)
  default = [
    "GroupMinSize",
    "GroupMaxSize",
    "GroupDesiredCapacity",
    "GroupInServiceInstances",
    "GroupPendingInstances",
    "GroupStandbyInstances",
    "GroupTerminatingInstances",
    "GroupTotalInstances",
  ]
}

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

variable "backup_aws_instance_type" {
  type        = string
  description = "AWS instance type for backup instances"
  default     = "t3.medium"
}

variable "backup_root_volume_size" {
  type        = string
  description = "Root EBS volume size for backup instances"
  default     = "80"
}

variable "backup_user_data" {
  type        = string
  description = "User data script for backup instances"
  default     = "echo 'hello'"
}

variable "backup_min_size" {
  type        = number
  description = "Minimum size for backup autoscaling group"
  default     = 1
}

variable "backup_max_size" {
  type        = number
  description = "Maximum size for backup autoscaling group"
  default     = 1
}

variable "backup_desired_capacity" {
  type        = number
  description = "Desired capacity for backup autoscaling group. Should typically match minimum"
  default     = 1
}

variable "backup_default_cooldown" {
  type        = number
  description = "Default cooldown period between scaling activities in seconds for backup autoscaling group"
  default     = 300
}

variable "backup_health_check_grace_period" {
  type        = number
  description = "Grace period before health checks begin, in seconds, for backup autoscaling group"
  default     = 300
}

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

# Route53 DNS settings
variable "route53_zone_id" {
  description = "AWS Route 53 zone id"
  default     = "Z21XEY26C989RH"
}

variable "route53_record_ttl" {
  description = "TTL associated with Route53 records"
  default     = "60"
}
