From de1386bed0fddce8b872bcbd8c11bbeed296ee51 Mon Sep 17 00:00:00 2001 From: Ryan Cheley Date: Sat, 17 Aug 2024 08:23:28 -0700 Subject: [PATCH 1/2] Rename variable skip_team_creation --- README.md | 2 +- terraform/README.md | 2 +- terraform/production/repositories.tfvars | 6 +++--- terraform/resources-repo-admin-teams.tf | 6 +++--- terraform/resources-repo-committer-teams.tf | 6 +++--- terraform/resources-repo-teams.tf | 8 ++++---- terraform/variables.tf | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index a807fca..b17478f 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ repositories = { template = "" # optional, default is "" topics = [] visibility = "public" # optional, default is "public" - skip_team_creation = optional(bool, false) # Do not create teams for repository + is_django_commons_repo = optional(bool, false) # Do not create teams for repository enable_branch_protection = true # optional, default is true required_status_checks_contexts = [] # optional, default is [] admins = [] # Members of the repository's admin and repository teams. Have admin permissions diff --git a/terraform/README.md b/terraform/README.md index 9232507..8097372 100644 --- a/terraform/README.md +++ b/terraform/README.md @@ -50,7 +50,7 @@ All changes should be made in `production/*.tfvars`: template = "" # optional, default is "" topics = [] visibility = "public" # optional, default is "public" - skip_team_creation = optional(bool, false) # Do not create teams for repository + is_django_commons_repo = optional(bool, false) # Do not create teams for repository enable_branch_protection = true # optional, default is true required_status_checks_contexts = [] # optional, default is [] admins = [] # Members of the repository's admin and repository teams. Have admin permissions diff --git a/terraform/production/repositories.tfvars b/terraform/production/repositories.tfvars index 984558c..abdcc6f 100644 --- a/terraform/production/repositories.tfvars +++ b/terraform/production/repositories.tfvars @@ -8,7 +8,7 @@ repositories = { topics = [] push_allowances = [] - skip_team_creation = true + is_django_commons_repo = true } "controls" = { @@ -19,7 +19,7 @@ repositories = { allow_squash_merge = true topics = [] push_allowances = [] - skip_team_creation = true + is_django_commons_repo = true } "membership" = { @@ -30,7 +30,7 @@ repositories = { allow_squash_merge = true topics = [] push_allowances = [] - skip_team_creation = true + is_django_commons_repo = true } "django-commons-playground" = { diff --git a/terraform/resources-repo-admin-teams.tf b/terraform/resources-repo-admin-teams.tf index 87e3641..c26608c 100644 --- a/terraform/resources-repo-admin-teams.tf +++ b/terraform/resources-repo-admin-teams.tf @@ -1,6 +1,6 @@ # Define the admin team for each repository resource "github_team" "repo_admin_team" { - for_each = { for k, v in var.repositories : k => v if v.skip_team_creation == false } + for_each = { for k, v in var.repositories : k => v if v.is_django_commons_repo == false } parent_team_id = github_team.repo_team[each.key].id name = "${each.key}-admins" @@ -10,7 +10,7 @@ resource "github_team" "repo_admin_team" { # Add the people to the team resource "github_team_members" "repo_admin_members" { - for_each = { for k, v in var.repositories : k => v if v.skip_team_creation == false } + for_each = { for k, v in var.repositories : k => v if v.is_django_commons_repo == false } team_id = github_team.repo_admin_team[each.key].id @@ -26,7 +26,7 @@ resource "github_team_members" "repo_admin_members" { # Define the team's permissions for the repositories resource "github_team_repository" "repo_admin_team_access" { - for_each = { for k, v in var.repositories : k => v if v.skip_team_creation == false } + for_each = { for k, v in var.repositories : k => v if v.is_django_commons_repo == false } repository = each.key team_id = github_team.repo_admin_team[each.key].id permission = "admin" diff --git a/terraform/resources-repo-committer-teams.tf b/terraform/resources-repo-committer-teams.tf index 27c51af..8bf5fc0 100644 --- a/terraform/resources-repo-committer-teams.tf +++ b/terraform/resources-repo-committer-teams.tf @@ -1,6 +1,6 @@ # Define the committers team for each repository resource "github_team" "repo_committer_team" { - for_each = { for k, v in var.repositories : k => v if v.skip_team_creation == false } + for_each = { for k, v in var.repositories : k => v if v.is_django_commons_repo == false } parent_team_id = github_team.repo_team[each.key].id name = "${each.key}-committers" @@ -12,7 +12,7 @@ resource "github_team" "repo_committer_team" { resource "github_team_members" "repo_committer_team_members" { for_each = { for k, v in var.repositories : k => v - if v.skip_team_creation == false && length(v.committers) > 0 + if v.is_django_commons_repo == false && length(v.committers) > 0 } team_id = github_team.repo_committer_team[each.key].id @@ -31,7 +31,7 @@ resource "github_team_members" "repo_committer_team_members" { resource "github_team_repository" "repo_committer_team_access" { for_each = { for k, v in var.repositories : k => v - if v.skip_team_creation == false + if v.is_django_commons_repo == false } repository = each.key team_id = github_team.repo_committer_team[each.key].id diff --git a/terraform/resources-repo-teams.tf b/terraform/resources-repo-teams.tf index e9ddc89..4dddd5a 100644 --- a/terraform/resources-repo-teams.tf +++ b/terraform/resources-repo-teams.tf @@ -1,6 +1,6 @@ # Create the main repository team for Django Commons. resource "github_team" "repo_team" { - for_each = { for k, v in var.repositories : k => v if v.skip_team_creation == false } + for_each = { for k, v in var.repositories : k => v if v.is_django_commons_repo == false } name = each.key description = "Main team for the ${each.key} repository" @@ -8,7 +8,7 @@ resource "github_team" "repo_team" { } # Add the people to the team resource "github_team_members" "repo_team_members" { - for_each = { for k, v in var.repositories : k => v if v.skip_team_creation == false } + for_each = { for k, v in var.repositories : k => v if v.is_django_commons_repo == false } team_id = github_team.repo_team[each.key].id @@ -27,7 +27,7 @@ resource "github_team_members" "repo_team_members" { } # Define the team's permissions for the repositories resource "github_team_repository" "repo_team_access" { - for_each = { for k, v in var.repositories : k => v if v.skip_team_creation == false } + for_each = { for k, v in var.repositories : k => v if v.is_django_commons_repo == false } repository = each.key team_id = github_team.repo_team[each.key].id permission = "triage" @@ -37,7 +37,7 @@ resource "github_team_repository" "repo_team_access" { # This is used to enable automatic PR review requests resource "github_team_settings" "this" { - for_each = { for k, v in var.repositories : k => v if v.skip_team_creation == false } + for_each = { for k, v in var.repositories : k => v if v.is_django_commons_repo == false } review_request_delegation { algorithm = "LOAD_BALANCE" diff --git a/terraform/variables.tf b/terraform/variables.tf index 654342f..1be2ecd 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -39,7 +39,7 @@ variable "repositories" { template = optional(string) topics = optional(list(string)) visibility = optional(string, "public") - skip_team_creation = optional(bool, false) # Do not create teams for repository + is_django_commons_repo = optional(bool, false) # Do not create teams for repository admins = optional(set(string), []) # Members of the repository's admin and repository teams. Have admin permissions committers = optional(set(string), []) # Members of the repository's committers and repository teams. Have write permissions From e2da756a3d735b3a2ec72bd26c84e9854e2f5866 Mon Sep 17 00:00:00 2001 From: ryancheley Date: Sat, 17 Aug 2024 15:25:18 +0000 Subject: [PATCH 2/2] [AUTO]Format code Files changed: M terraform/production/repositories.tfvars M terraform/variables.tf --- terraform/production/repositories.tfvars | 20 ++++++++++---------- terraform/variables.tf | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/terraform/production/repositories.tfvars b/terraform/production/repositories.tfvars index abdcc6f..43a0910 100644 --- a/terraform/production/repositories.tfvars +++ b/terraform/production/repositories.tfvars @@ -6,8 +6,8 @@ repositories = { description = "A Special Repository." enable_branch_protection = false - topics = [] - push_allowances = [] + topics = [] + push_allowances = [] is_django_commons_repo = true } @@ -19,17 +19,17 @@ repositories = { allow_squash_merge = true topics = [] push_allowances = [] - is_django_commons_repo = true + is_django_commons_repo = true } "membership" = { - description = "Membership repository for the django-commons organization." - visibility = "public" - allow_merge_commit = true - allow_rebase_merge = true - allow_squash_merge = true - topics = [] - push_allowances = [] + description = "Membership repository for the django-commons organization." + visibility = "public" + allow_merge_commit = true + allow_rebase_merge = true + allow_squash_merge = true + topics = [] + push_allowances = [] is_django_commons_repo = true } diff --git a/terraform/variables.tf b/terraform/variables.tf index 1be2ecd..00cd00b 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -39,7 +39,7 @@ variable "repositories" { template = optional(string) topics = optional(list(string)) visibility = optional(string, "public") - is_django_commons_repo = optional(bool, false) # Do not create teams for repository + is_django_commons_repo = optional(bool, false) # Do not create teams for repository admins = optional(set(string), []) # Members of the repository's admin and repository teams. Have admin permissions committers = optional(set(string), []) # Members of the repository's committers and repository teams. Have write permissions