provider "aws" {
  region = var.aws_region
}

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

data "aws_caller_identity" "current" {}

# Add WAF for all UAT orcd cloudfront distributions
module "orcd_cloudfront_shared_waf" {
  source            = "git@github.com:theorchard/terraform-aws-waf.git//?ref=2.0.1"
  environment       = var.environment
  service_name      = "${var.service_name}-cloudfront"
  aws_region        = var.aws_region
  acl_scope         = "CLOUDFRONT"
  count_waf_enabled = false
  block_waf_enabled = true
  excluded_rules = [
    "NoUserAgent_HEADER",
  ]
}
