From 9bc43137578b4cabdf342c06776917e61875d4b6 Mon Sep 17 00:00:00 2001 From: Dave Arnold Date: Mon, 8 Jul 2024 10:53:35 -0700 Subject: [PATCH] Refactor Terraform code for consistency and readability --- github_repo.tf | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/github_repo.tf b/github_repo.tf index 9e44f83..85f372d 100644 --- a/github_repo.tf +++ b/github_repo.tf @@ -2,8 +2,7 @@ locals { repo_name = var.force_name ? var.name : "${var.name}-${formatdate("YYYYMMDD", timestamp())}" } -resource "github_repository" "repo_force_name" { - count = var.force_name ? 1 : 0 +resource "github_repository" "repo" { name = local.repo_name description = var.github_repo_description visibility = var.github_is_private ? "private" : "public" @@ -37,41 +36,3 @@ resource "github_repository" "repo_force_name" { } } } - - -resource "github_repository" "repo_ignore_name_change" { - count = var.force_name ? 0 : 1 - name = local.repo_name - description = var.github_repo_description - visibility = var.github_is_private ? "private" : "public" - auto_init = var.github_auto_init - allow_merge_commit = var.github_allow_merge_commit - allow_squash_merge = var.github_allow_squash_merge - allow_rebase_merge = var.github_allow_rebase_merge - archive_on_destroy = true - delete_branch_on_merge = var.github_delete_branch_on_merge - has_projects = var.github_has_projects - has_issues = var.github_has_issues - has_wiki = var.github_has_wiki - topics = var.github_repo_topics - gitignore_template = "Terraform" - is_template = var.is_template - archived = var.archived - lifecycle { - ignore_changes = [ - name, - has_issues, - has_projects, - has_wiki - ] - } - dynamic "template" { - # A bogus map for a conditional block - for_each = var.template_repo == null ? [] : ["*"] - content { - owner = var.template_repo_org - repository = var.template_repo - # include_all_branches = var.template_include_all_branches - } - } -}