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

provider "aws" {
  region = var.aws_region
}

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

module "terraform_state_bucket" {
  source                 = "git@github.com:theorchard/terraform-s3.git//modules/s3_bucket?ref=3.15.7"
  env                    = var.environment
  application_family     = var.application_family
  bucket_name            = "${var.account_group}-terraform-state"

  apply_server_side_encryption_by_default = {
    sse_algorithm = "AES256"
  }
}
