variable "aws_region" {
  description = "AWS region"
  default     = "us-east-1"
}

variable "environment" {
  description = "Available values: dev, qa, prod."
  default     = "qa"
}

variable "service_name" {
  default = "fivetran-webhooks"
}

variable "application_family" {
  default = "audience-development"
}

variable "lambda_name" {
  default = "lambda-audience-fivetran-webhooks"
}

variable "lambda_timeout" {
  default = 60
}

variable "load_balancer_access_logs_bucket_name" {
  description = "ELB access-logs bucket name."
  type        = string
  default     = "orch-elb-logs"
}

variable "trusted_cidr_blocks" {
  description = "List of CIDR blocks to allow access from."
  type        = list(string)
  default = [
    # The Orchard VPC
    "10.10.40.0/22",
    "10.30.0.0/22",
    "10.40.0.0/22",
    "192.168.31.0/24",
    "192.168.32.0/24",
    "192.168.33.0/24",
    "192.168.40.0/22",
    # The Orchard VPN External IP
    "207.237.185.0/26",
    # The Orchard Tallinn office IP
    "95.153.54.178/32",
    # Fivetran - GCP (https://fivetran.com/docs/getting-started/ips#googlecloudplatform)
    "35.234.176.144/29", # us-east4
    "34.85.252.27/32",   ## Fivetran API Responses
    "35.227.135.0/29",   # us-west1
    "35.227.135.4/32",   ## Fivetran Webhook Sender
    "35.197.105.90/32",  ## Fivetran API Responses
    "136.107.62.136/29", ## Fivetran IP range
    "136.118.115.24/29", ## Fivetran IP range
  ]
}

variable "acm_certificate_domain" {
  description = "Certificate Manager certificate domain."
  type        = string
  default     = "*.theorchard.io"
}

variable "route53_dns_zone" {
  description = "Route53 DNS zone name."
  type        = string
  default     = "theorchard.io"
}

variable "fivetran_shopify_group_id" {
  default = "glade_scone"
}

variable "fivetran_reporting_group_id" {
  default = "childish_peritonitis"
}

locals {
  load_balancer_name                = "${var.environment}-audience-${var.service_name}"
  load_balancer_route53_record_name = "${local.load_balancer_name}.${var.route53_dns_zone}"

  tags = {
    environment        = var.environment
    application_family = var.application_family
    service_name       = var.lambda_name
    terraformed        = true
    eiso-exception     = "aws.08.30"
  }
}
