variable "application_family" {
  type    = string
  default = "devops"
}

variable "team_name" {
  type    = string
  default = "devops"
}

variable "account_group" {
  description = "Account Group"
  default     = "orcd"
}

variable "environment" {
  description = "The name of the environment"
  default     = "shared"
}

variable "vpc_routing_destination_prefix_lists" {
  type        = list(string)
  description = "list of prefix lists names that should be routable from the private subnets"
  default = [
    "dev-orcd-private-subnet-prefix-list",
    "prod-accounting-private-subnet-prefix-list",
    "prod-fansifter-private-subnet-prefix-list",
    "prod-orcd-private-subnet-prefix-list",
    "prod-permissions-platform-private-subnet-prefix-list",
    "qa-accounting-private-subnet-prefix-list",
    "qa-fansifter-private-subnet-prefix-list",
    "qa-permissions-platform-private-subnet-prefix-list",
    "vpn-ny",
    "vpn-sme-internal-primary",
    "qa-supply-chain-private-subnet-prefix-list",
    "prod-supply-chain-private-subnet-prefix-list",
    "uat-accounting-private-subnet-prefix-list",
    "uat-orcd-private-subnet-prefix-list",
    "qa-mobile-code-push-private-subnet-prefix-list",
    "prod-mobile-code-push-private-subnet-prefix-list",
    "dev-eom-digsys-d3-private-subnet-prefix-list",
    "prod-eom-digsys-p3-private-subnet-prefix-list",
    "prod-amp-amp-aas-p2-private-subnet-prefix-list",
    "qa-switchboard-private-subnet-prefix-list",
  ]
}

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
    "arn:aws:organizations::970903126758:ou/o-bqioddgr91/ou-ax9e-nxfxc71f", # digsys projects are still under SME OUs (eom-dev)
    "arn:aws:organizations::970903126758:ou/o-bqioddgr91/ou-ax9e-dc402ggh", # digsys projects are still under SME OUs (eom-prod)
  ]
}

variable "sme_principals_for_default_private_subnet_share" {
  type        = set(string)
  description = "List of additional principals to share the default (not service-specific) private subnet prefix lists with"
  default = [
    "358364484590",
    "613871678587",
    "765134955759", # DX QA
    #"729038418454", # DX PROD
  ]
}

variable "resource_share_regions" {
  type        = set(string)
  description = "The regions to share the prefix list to"
  default     = ["us-east-1", "eu-central-1", "us-west-2"]
}

variable "associated_route53_zone_ids" {
  type        = set(string)
  description = "A list of Route 53 zone IDs to associate the VPC with"
  default = [
    "Z0317998NAZYP2141JBV" # qaorch.com
  ]
}

locals {
  internal_routes = [
    for tuple in setproduct(toset(module.vpc.private_route_table_ids), toset(data.aws_ec2_managed_prefix_lists.required_routes.ids)) : {
      route_table_id = tuple[0]
      prefix_list_id = tuple[1]
    }
  ]

  common_tags = {
    account_group = var.account_group
    environment   = var.environment
    terraformed   = true
  }
}
