variable "region" {
  type        = string
  description = "The AWS region"
  default     = "us-east-1"
}

variable "environment" {
  type        = string
  description = "The environment"
  default     = "shared"
}

variable "service_name" {
  type        = string
  description = "The name of the service."
  default     = "rds-refresh"
}

variable "application_family" {
  type        = string
  description = "The name of the application family."
  default     = "devops"
}

variable "team_name" {
  type        = string
  description = "The name of the team."
  default     = "devops"
}

variable "source_account_role_name" {
  type        = string
  description = "Name of IAM role to assume in each AWS account. Should be the same across accounts"
  default     = "prod-rds-refresh-backup-role"
}

variable "source_account_kms_key_id" {
  type        = string
  description = "The ID of the KMS key to use to share snapshots. Should be the same across accounts."
  default     = "alias/prod-rds-refresh-shared-snapshots"
}

variable "create_shareable_snapshot_task_revision" {
  type        = number
  description = "The task definition revision of the create-shareable-snapshot task to use"
  default     = 53
}

variable "restore_task_revision" {
  type        = number
  description = "The task definition revision of the restore task to use"
  default     = 60
}

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

variable "secrets_manager_secret_names" {
  type        = list(string)
  description = "List of secrets to create"
  default = [
    "SNOWFLAKE_USER",
    "SNOWFLAKE_PRIVATE_KEY",
    "SNOWFLAKE_PRIVATE_KEY_PASSPHRASE",
    "dev-royalty-accounting/SNOWFLAKE_USER",
    "dev-royalty-accounting/SNOWFLAKE_PRIVATE_KEY",
    "dev-royalty-accounting/SNOWFLAKE_PRIVATE_KEY_PASSPHRASE",
    "qa-royalty-accounting/SNOWFLAKE_USER",
    "qa-royalty-accounting/SNOWFLAKE_PRIVATE_KEY",
    "qa-royalty-accounting/SNOWFLAKE_PRIVATE_KEY_PASSPHRASE",
    "uat-royalty-accounting/SNOWFLAKE_USER",
    "uat-royalty-accounting/SNOWFLAKE_PRIVATE_KEY",
    "uat-royalty-accounting/SNOWFLAKE_PRIVATE_KEY_PASSPHRASE",
    "FIVETRAN_API_KEY",
    "FIVETRAN_API_KEY_SECRET",
  ]
}

locals {
  source_account_ids = [
    module.aws_accounts.all_accounts["prod"],
    module.aws_accounts.all_accounts["songwhip-prod"],
  ]

  target_roles = [
    {
      account_id = module.aws_accounts.all_accounts["prod"]
      name       = "qa-rds-refresh-restore-role"
    },
    {
      account_id = module.aws_accounts.all_accounts["dev"]
      name       = "dev-rds-refresh-restore-role"
    },
    {
      account_id = module.aws_accounts.all_accounts["accounting-qa"]
      name       = "qa-rds-refresh-restore-role"
    },
    {
      account_id = module.aws_accounts.all_accounts["accounting-qa"]
      name       = "uat-rds-refresh-restore-role"
    },
    {
      account_id = module.aws_accounts.all_accounts["songwhip-qa"]
      name       = "qa-rds-refresh-restore-role"
    },
  ]
}
