Skip to content

Commit

Permalink
Update github_repo.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
David Arnold authored and GitHub committed Jul 8, 2024
1 parent f63bb9c commit cf3a5c3
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion github_repo.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,50 @@ locals {
repo_name = var.force_name ? var.name : "${var.name}-${formatdate("YYYYMMDD", timestamp())}"
}
resource "github_repository" "repo" {
moved {
from = github_repository.repo
to = github_repository.repo_force_name
}
resource "github_repository" "repo_force_name" {
count = var.force_name ? 1 : 0
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 = [
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
}
}
}


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"
Expand Down

0 comments on commit cf3a5c3

Please sign in to comment.