Skip to content

Commit

Permalink
chore: Refactor Terraform code for consistency and readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Arnold committed Jul 8, 2024
1 parent cf3a5c3 commit b6176dd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion collaborators.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add a collaborator to a repository
resource "github_repository_collaborator" "collaborators" {
for_each = tomap(var.collaborators)
for_each = tomap(var.collaborators)
repository = github_repository.repo.name
username = each.key
permission = each.value
Expand Down
8 changes: 4 additions & 4 deletions github_repo.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ locals {
}
moved {
from = github_repository.repo
to = github_repository.repo_force_name
from = "github_repository.repo"
to = "github_repository.repo_force_name"
}
resource "github_repository" "repo_force_name" {
count = var.force_name ? 1 : 0
count = var.force_name ? 1 : 0
name = local.repo_name
description = var.github_repo_description
visibility = var.github_is_private ? "private" : "public"
Expand Down Expand Up @@ -45,7 +45,7 @@ resource "github_repository" "repo_force_name" {


resource "github_repository" "repo_ignore_name_change" {
count = var.force_name ? 0 : 1
count = var.force_name ? 0 : 1
name = local.repo_name
description = var.github_repo_description
visibility = var.github_is_private ? "private" : "public"
Expand Down
6 changes: 3 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ variable "enforce_prs" {
type = bool
}

variable collaborators {
type = map(string)
variable "collaborators" {
type = map(string)
description = "list of repo callaborators"
default = {}
default = {}
}

0 comments on commit b6176dd

Please sign in to comment.