provider "github" {
  owner = var.github_organization
}

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

module "github_repositories" {
  for_each = var.github_repositories
  source   = "git@github.com:theorchard/terraform-github.git//?ref=6.1.1"

  repository_name                  = each.key
  description                      = each.value.description
  default_code_owner               = "collaborators"
  branch_protection_enabled        = each.value.branch_protection_enabled
  branch_protection_enforce_admins = each.value.branch_protection_enforce_admins
  archived_repository              = each.value.archived_repository
  application_family               = var.application_family
  homepage_url                     = each.value.homepage_url
}
