module "default_tags" {
  source             = "git@github.com:theorchard/terraform-default-tags.git//?ref=1.0.0"
  environment        = var.environment
  application_family = var.application_family
}

provider "aws" {
  region = var.aws_region

  default_tags {
    tags = module.default_tags.tags
  }
}

# Terraform backends cannot contain interpolations
terraform {
  backend "s3" {
    bucket  = "qa-business-solutions-terraform-state"
    key     = "qa/waf/terraform.tfstate"
    region  = "us-east-1"
    encrypt = "true"
  }
}

module "environment_web_acls" {
  source                            = "git@github.com:theorchard/terraform-aws-waf.git//?ref=2.0.2"
  environment                       = var.environment
  aws_region                        = var.aws_region
  count_waf_enabled                 = true
  block_waf_enabled                 = true
}

module "environment_cloudfront_acls" {
  source                            = "git@github.com:theorchard/terraform-aws-waf.git//?ref=2.0.2"
  environment                       = var.environment
  aws_region                        = var.aws_region
  acl_scope                         = "CLOUDFRONT"
  count_waf_enabled                 = true
  block_waf_enabled                 = true
}

module "gsirt_blocking_rule_group" {
  source                 = "git@github.com:theorchard/terraform-gsirt-waf-ip-block-rule.git//?ref=1.1.0"
  environment            = var.environment
  reuse_existing_ip_sets = true
}
