##################### COMMON VARIABLES #######################
variable "account_name" {
  description = "Name of the AWS account"
  type        = string
  default     = "sme-supply-chain-max-PROD"
}

variable "account_id" {
  description = "AWS Account Number of sme-supply-chain-max-PROD"
  type        = string
  default     = "504436705349"
}

variable "region" {
  description = "Name of the region"
  type        = string
  default     = "eu-central-1"
}

variable "assume_role" {
  description = "The role used for infra changes"
  type        = string
  default     = "arn:aws:iam::504436705349:role/AnsibleAWSServiceAccess-MAX-P"
}

variable "tags" {
  description = "A map of tags to add to all resources"
  type        = map(string)

  default = {
    Terraform     = "True"
    Business-Unit = "SME-MAX"
    Environment   = "PROD"
    Name          = "MAX-P3"
    Owner         = "chris.mollis.objectlab@sonymusic.com"
    Project-Code  = "SME-2000-0590E"
    Project-Name  = "SME-Max-PROD"
    POC           = "chris.mollis.objectlab@sonymusic.com"
  }
}

variable "https_port" {
  description = "HTTPS Port"
  type        = number
  default     = 443
}

variable "host_header" {
  description = "Host Header"
  type        = string
  default     = "digsys-prod.smecloudops.com"
}

##################### SECURITY GROUPS VARIABLES #######################

variable "sg_use_name_prefix" {
  description = "To use SG prefix"
  type        = bool
  default     = false
}

##################### VPC VARIABLES #######################

variable "vpc_name" {
  description = "VPC Name"
  type        = string
  default     = "MAX-P3"
}

variable "vpc_cidr" {
  description = "Primary VPC CIDR"
  type        = string
  default     = "10.250.93.0/24"
}

variable "vpc_id" {
  type    = string
  default = "vpc-081a4216f852f621b"
}

variable "secondary_cidr_blocks" {
  description = "Secondary CIDR blocks"
  type        = list(string)
  default     = ["10.249.6.32/28", "10.11.107.64/26", "10.251.12.0/22"]
}

variable "public_subnets" {
  description = "Public Subnets"
  type        = list(string)
  default     = ["10.250.93.0/27", "10.250.93.32/27", "10.249.6.32/28"]
}

variable "private_subnets" {
  description = "Private Subnets"
  type        = list(string)
  default     = ["10.250.93.128/26", "10.250.93.193/26", "10.11.107.64/27", "10.11.107.96/27", "10.251.12.0/24", "10.251.13.0/24", "10.251.14.0/24"]
}

variable "database_subnets" {
  description = "Database Subnets"
  type        = list(string)
  default     = ["10.250.93.96/27", "10.250.93.64/27"]
}

variable "intra_subnets" {
  description = "Intra Subnets"
  type        = list(string)
  default     = []
}

variable "emr_subnets" {
  description = "Elastic cache Subnets"
  type        = list(string)
  default     = []
}

variable "create_redshift_subnet_group" {
  description = "To create redshift subnet group"
  type        = bool
  default     = false
}

variable "dhcp_domain_name_servers" {
  description = "DNS IPS"
  type        = list(string)
  default     = ["162.49.203.44", "10.250.197.130"]
}

variable "local_s3_arn" {
  description = "Flow logs stored in same account S3 bucket"
  type        = string
  default     = "arn:aws:s3:::sme-supply-chain-max-PROD-eu-central-1-logs"
}

variable "centralised_s3_arn" {
  description = "Flow logs stored in centralised account S3 bucket"
  type        = string
  default     = "arn:aws:s3:::sme-core-cloud-compliance-centralised-vpc-flowlogs"
}

variable "enable_dhcp_options" {
  description = "To enable DHCP options for VPC"
  type        = bool
  default     = true
}

variable "flow_log_max_aggregation_interval" {
  description = "VPC Flow logs interval"
  type        = number
  default     = 600
}

variable "flow_log_cloudwatch_iam_role_arn" {
  description = "IAM role ARN for flow logs"
  type        = string
  default     = "arn:aws:iam::504436705349:role/flowlogsRole"
}

variable "route_zone" {
  description = "Route53 zone name for this VPC"
  type        = string
  default     = "smedigsysp3"
}

variable "instance_tenancy" {
  description = "Instance Tenancy for this VPC"
  type        = string
  default     = "default"
}

variable "enable_network_address_usage_metrics" {
  description = "enable_network_address_usage_metrics"
  type        = bool
  default     = false
}

variable "enable_dns_support" {
  description = "enable_dns_support"
  type        = bool
  default     = true
}

variable "enable_dns_hostnames" {
  description = "enable_dns_hostnames"
  type        = bool
  default     = true
}

variable "assign_generated_ipv6_cidr_block" {
  description = "assign_generated_ipv6_cidr_block"
  type        = bool
  default     = false
}

variable "assign_ipv6_address_on_creation" {
  description = "assign_ipv6_address_on_creation"
  type        = bool
  default     = false
}

variable "enable_dns64" {
  description = "enable_dns64"
  type        = bool
  default     = false
}

variable "enable_resource_name_dns_a_record_on_launch" {
  description = "enable_resource_name_dns_a_record_on_launch"
  type        = bool
  default     = false
}

variable "enable_resource_name_dns_aaaa_record_on_launch" {
  description = "enable_resource_name_dns_aaaa_record_on_launch"
  type        = bool
  default     = false
}

variable "ipv6_native" {
  description = "ipv6_native"
  type        = bool
  default     = false
}

variable "map_public_ip_on_launch" {
  description = "ipv6_native"
  type        = bool
  default     = false
}

variable "private_dns_hostname_type_on_launch" {
  description = "private_dns_hostname_type_on_launch"
  type        = string
  default     = "ip-name"
}

##################### EC2 VARIABLES #######################

variable "default_ami" {
  description = "AMI to use for all instances"
  type        = string
  default     = "ami-04949fe15ac570674"
}

variable "instance_type" {
  description = "Default instance type to use"
  type        = string
  default     = "t3.medium"
}

variable "ssh_key_name" {
  description = "Default instance Key to use"
  type        = string
  default     = "digital-systems-d-05MAR2024"
}

variable "ec2_monitoring" {
  description = "EC2 Monitoring"
  type        = bool
  default     = false
}

variable "disable_api_termination" {
  description = "EC2 termination protection"
  type        = bool
  default     = true
}

variable "ec2_tags" {
  description = "A map of tags to add to all resources"
  type        = map(string)

  default = {
    CLOPS_APPROVED = "True"
    Terraform      = "True"
    Business-Unit  = "SME-MAX"
    Environment    = "PROD"
    Name           = "MAX-P3"
    Owner          = "chris.mollis.objectlab@sonymusic.com"
    Project-Code   = "SME-2000-0590E"
    Project-Name   = "SME-Max-PROD"
    POC            = "chris.mollis.objectlab@sonymusic.com"
    OS             = "AL3"
    SERVER_TYPE    = "EC2"
    OPS            = "STND"
    DATA           = "NORMAL"
    Patch_Group    = "General"
  }
}

variable "cloudops_firewall_protected_tag" {
  description = "Used to tag an EC2 instance as being protected by a firewall, either Network Firewall or PaloAlto"
  type        = map(string)

  default = {
    CLOPS_FW = "YES"
  }
}

##################### ALB VARIABLES #######################

variable "internal" {
  description = "ALB type"
  type        = bool
  default     = true
}

variable "enable_deletion_protection" {
  description = "ALB deletion protection"
  type        = bool
  default     = true
}

variable "enable_waf_fail_open" {
  description = "ALB WAF"
  type        = bool
  default     = true
}

variable "drop_invalid_header_fields" {
  description = "ALB drop invalid headers"
  type        = bool
  default     = true
}

variable "alb_certificate_arn" {
  description = "ALB listener certificate ARN"
  type        = string
  default     = ""
}

variable "alb_ssl_policy" {
  description = "ALB Security Policy"
  type        = string
  default     = "ELBSecurityPolicy-TLS13-1-2-2021-06"
}

variable "alb_logs_bucket" {
  description = "ALB logs bucket"
  type        = string
  default     = "digital-systems-prod-frankfurt-elb-logs"
}

##################### EFS VARIABLES #######################

variable "posix_uid" {
  description = "POSIX user ID"
  type        = number
  default     = 1184
}

variable "posix_gid" {
  description = "POSIX group ID"
  type        = number
  default     = 2006
}

variable "posix_permissions" {
  description = "POSIX permissions"
  type        = number
  default     = 755
}

##################### EKS VARIABLES #####################

variable "cluster_name" {
  type    = string
  default = "max-prod-eks"
}

variable "cluster_version" {
  type    = string
  default = "1.32"
}

variable "eks_ami" {
  type    = string
  default = "ami-075c2e868f8a75609"
}

variable "eks_instance_type" {
  type    = string
  default = "t3.large"
}

variable "eks_ssh_key" {
  type    = string
  default = "maxffp-12feb2020"
}

variable "add_nodegroup_iam_policies" {
  type    = bool
  default = false
}

variable "additional_nodegroup_policies" {
  type    = list(string)
  default = []
}

variable "node_group_role_arn" {
  type    = string
  default = "arn:aws:iam::504436705349:role/max-p3-eks-worker-node-role"
}

variable "enabled_cluster_log_types" {
  type    = list(string)
  default = ["api", "audit", "authenticator", "controllerManager", "scheduler"]
}

variable "eks_cluster_role_arn" {
  type    = string
  default = "arn:aws:iam::504436705349:role/max-p3-eks-cluster-service-role"
}

variable "encryption_config_resources" {
  type    = list(string)
  default = ["secrets"]
}

variable "encryption_config_provider_key_arn" {
  type    = string
  default = "arn:aws:kms:eu-central-1:504436705349:key/062d85b5-836f-44ef-a603-d0fdfe01113e"
}

variable "vpc_config_endpoint_private_access" {
  type    = bool
  default = true
}

variable "vpc_config_endpoint_public_access" {
  type    = bool
  default = false
}

variable "environment" {
  description = "Environment name"
  default     = "prod"
}

variable "account_group" {
  description = "The name of the account group that the account belongs to"
  default     = "supply-chain"
}

variable "resource_share_principals" {
  type        = set(string)
  description = "List of principals to share resources with using RAM"
  default = [
    "arn:aws:organizations::970903126758:ou/o-bqioddgr91/ou-ax9e-vu43qt3i", # The Orchard OU
    "arn:aws:organizations::970903126758:ou/o-bqioddgr91/ou-ax9e-ouayejxi", # Data Strategy aka GDB OU
  ]
}
