Skip to content

Commit

Permalink
cleanup tf code (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
cunla committed Aug 3, 2024
1 parent 0ac38c1 commit 4f1176e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 15 deletions.
4 changes: 0 additions & 4 deletions terraform/production/org.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ organization_teams = {
"matthiask"
]
permission = "push"

repositories = [
"django-commons-playground",
]
}
}

Expand Down
5 changes: 1 addition & 4 deletions terraform/resources-org.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,16 @@ resource "github_team_members" "org_team_members" {
for_each = each.value.members

content {
# members here references the dynamic name, not the looped entity.
username = members.value
role = "member"
}
}

# Maintainer here means the maintainer role for the team.
# It's not a maintainer of the repo.
# Maintainer here means the maintainer role for the team. It's not a maintainer of the repo.
dynamic "members" {
for_each = each.value.maintainers

content {
# members here references the dynamic name, not the looped entity.
username = members.value
role = "maintainer"
}
Expand Down
6 changes: 1 addition & 5 deletions terraform/resources-repos.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
# https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository

resource "github_repository" "this" {

# Ensure GitHub repository is Private
# checkov:skip=CKV_GIT_1: Public is ok for us since we are an open source project

for_each = var.repositories

allow_auto_merge = each.value.allow_auto_merge
Expand Down Expand Up @@ -62,7 +58,7 @@ resource "github_repository" "this" {
# required_pull_request_reviews {
# dismiss_stale_reviews = true
# require_code_owner_reviews = true
# required_approving_review_count = 1
# required_approving_review_count = github_repository.this[each.key].required_approving_review_count
# }
#
# required_status_checks {
Expand Down
3 changes: 1 addition & 2 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ variable "repositories" {
allow_squash_merge = optional(bool, true)
allow_update_branch = optional(bool, true)
delete_branch_on_merge = optional(bool, true)
enable_branch_protection = optional(bool, true)
has_discussions = optional(bool, true)
has_downloads = optional(bool, true)
has_wiki = optional(bool, false)
is_template = optional(bool, false)
push_allowances = optional(list(string), [])
enable_branch_protection = optional(bool, true)
required_status_checks_contexts = optional(list(string), [])
template = optional(string)
topics = optional(list(string))
Expand All @@ -60,7 +60,6 @@ variable "organization_teams" {
members = optional(set(string), [])
permission = optional(string, null)
privacy = optional(string, "closed")
repositories = optional(set(string), [])
review_request_delegation = optional(bool, false)
}))
}
Expand Down

0 comments on commit 4f1176e

Please sign in to comment.