provider "aws" {
  region = var.aws_region
}

# Terraform backends cannot contain interpolations
terraform {
  backend "s3" {
    bucket  = "orcd-terraform-state"
    key     = "prod/github/daemon-notifications-delivery/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           = "daemon-notifications-delivery"
  description               = "The final step of The Orchard Notification System"
  application_family        = var.application_family
  default_code_owner        = "orchard-suite-platform-osp"
  github_push_teams         = ["mergers", "orchard-suite-platform-osp"]
  github_code_owner_reviews = true
}

import {
  to = module.github_repositories.github_branch_default.default
  id = "daemon-notifications-delivery"
}

import {
  to = module.github_repositories.github_repository_file.codeowners
  id = "daemon-notifications-delivery:.github/CODEOWNERS:"
}

moved {
  from = module.github_repositories.github_repository.orchard_repository["daemon-notifications-delivery"]
  to   = module.github_repositories.github_repository.orchard_repository
}

moved {
  from = module.github_repositories.github_team_repository.team_repo_push_permissions["7223367/daemon-notifications-delivery"]
  to   = module.github_repositories.github_team_repository.team_repo_push_permissions["7223367"]
}

moved {
  from = module.github_repositories.github_team_repository.team_repo_triage_permissions["743816/daemon-notifications-delivery"]
  to   = module.github_repositories.github_team_repository.team_repo_triage_permissions["743816"]
}

moved {
  from = module.github_repositories.github_repository_custom_property.repo_custom_property["daemon-notifications-delivery-application_family"]
  to   = module.github_repositories.github_repository_custom_property.repo_custom_property["application_family"]
}

moved {
  from = module.github_repositories.github_branch_protection.branch_protection["daemon-notifications-delivery-master"]
  to   = module.github_repositories.github_branch_protection.branch_protection["master"]
}
