variable "aws_region" {
  default = "us-east-1"
}

variable "environment" {
  default = "prod"
}

variable "service_name" {
  default = "ioc"
}

variable "application_family" {
  default = "devops"
}

variable "team_name" {
  default = "devops"
}

variable "state_machine_name" {
  default = "ioc-block"
}

variable "external_id" {
  type        = string
  description = "The external ID to use when assuming roles in other accounts"
  default     = "Gq4Fobwfoq1QrHDqiZSbSmSDiKdtss"
}

variable "domain_list_id" {
  type        = string
  description = "The ID of the domain list to use for updating DNS firewall"
  default     = "rslvr-fdl-5b59af9ed3cd484f"
}

variable "notifications_slack_email_address" {
  type    = string
  default = "serverwizards-aaaacsnjxmyik6lv54cum5y4w4@orcd.slack.com"
}

variable "notifications_gsirt_email_address" {
  type    = string
  default = "infosec.irt@sonymusic.com"
}

variable "slack_notification_channel" {
  type    = string
  default = "@slack-The_Orchard-devops-internal-alerts"
}

locals {
  excluded_accounts = [
    "backup",
    "dx-prod",
    "dx-qa", # remove this when account is fully bootstrapped.
    "royaltyshare",
    "sme-amp-dev",
    "sme-amp-prod",
    "sme-aoma-core-dev",
    "sme-aoma-core-prod",
    "sme-aoma-delivery-dev",
    "sme-aoma-delivery-prod",
    "sme-dc-dev",
    "sme-dc-prod",
    "sme-eom-dev",
    "sme-eom-prod",
    "sme-global-ds-dev",
    "sme-global-ds-prod",
    "sme-grps-dev",
    "sme-grps-prod",
    "sme-mc-sec-dev",
    "sme-mc-sec-prod",
    "sme-media-conversion-dev",
    "sme-media-conversion-prod",
    "sme-media-services-dev",
    "sme-media-services-prod",
    "sme-supply-chain-max-dev",
    "sme-supply-chain-max-prod",
  ]
  update_waf_ipset_input = [
    for k, v in module.aws_accounts.accounts_map : {
      "account_id" = v.account_id,
      "ip_sets" = [
        { "scope" = "CLOUDFRONT" },
        merge({ "scope" = "REGIONAL" }, (k == "gdb-whitelist-legacy" ? { "region" = "eu-west-1" } : {}))
      ]
    }
    if !contains(local.excluded_accounts, v.name)
  ]
}
