provider "aws" {
  region = var.aws_region
}

provider "github" {
  owner = "theorchard"
}

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

module "github_repositories" {
  source                            = "git@github.com:theorchard/terraform-github.git//?ref=6.0.2"
  repository_name                   = "orchardgo"
  description                       = "Mobile application for The Orchard, AWAL and SME."
  default_code_owner                = "mobile-suite"
  allow_merge_commit                = false
  allow_rebase_merge                = false
  allow_squash_merge                = true
  application_family                = "mobile"
  required_approving_review_count   = 2
  require_branches_to_be_up_to_date = false
  branch_protection_patterns        = ["main", "master"]

  github_push_teams = [
    "mergers",
  ]

  required_status_checks = [
    "default",
    "pr-title",
  ]

  pull_request_bypassers = [
    "kud",
    "muryj",
    "zyvpeople",
  ]

  autolink_references = [
    {
      key_prefix          = "GO-"
      target_url_template = "https://theorchard.atlassian.net/browse/GO-<num>"
    },
  ]
}
