# This is the region of the primary bucket and most other components
provider "aws" {
  region = "us-east-1"
}

# This is the region of the failover bucket
provider "aws" {
  region = "us-west-2"
  alias  = "failover"
}

# Terraform backends cannot contain interpolations
terraform {
  backend "s3" {
    bucket  = "dev-orcd-terraform-state"
    key     = "dev/terraform-spa/terraform.tfstate"
    region  = "us-east-1"
    encrypt = "true"
  }
}

module "spa_environment" {
  source = "../../"
  providers = {
    aws.primary = aws
    aws.failover = aws.failover
  }

  environment                           = var.environment
  service_name                          = var.service_name
  application_family                    = var.application_family
  brand                                 = var.brand
  custom_response_headers_policy_name   = "Managed-SecurityHeadersPolicy"
  # Pick two buckets in different regions. In qa/prod these values do not typically need to be specified.
  custom_origin_primary_s3_bucket_name  = "elasticbeanstalk-us-east-1-103233932089"
  custom_origin_failover_s3_bucket_name = "elasticbeanstalk-us-west-2-103233932089"
}