diff --git a/README.md b/README.md index 9bcaf7d..ca695d2 100644 --- a/README.md +++ b/README.md @@ -356,6 +356,7 @@ No modules. | [template\_repo\_org](#input\_template\_repo\_org) | Template repository organization | `string` | `null` | no | | [vars](#input\_vars) | GitHub Actions variables |
list(object({
name = string
value = string
})) | `[]` | no |
| [vulnerability\_alerts](#input\_vulnerability\_alerts) | Enable Dependabot alerts | `bool` | `false` | no |
+| [deploy\_keys](#input\_deploy\_keys) | List of SSH deploy keys to add to the repository | list(object({
title = string
key = string
read_only = optional(bool, true)
})) | `[]` | no |
## Outputs
diff --git a/branch_protection.tf b/branch_protection.tf
index 344bbd3..a60544c 100644
--- a/branch_protection.tf
+++ b/branch_protection.tf
@@ -52,6 +52,9 @@ resource "github_branch_protection" "protection" {
depends_on = [
github_repository.repo,
github_branch.branch,
- github_branch_default.default_main_branch
+ github_branch_default.default_main_branch,
+ github_repository_files.extra_files,
+ github_repository_file.codeowners,
+ github_repository_file.managed_extra_files
]
}
\ No newline at end of file
diff --git a/github_files.tf b/github_files.tf
index e4dee3a..ebd4931 100644
--- a/github_files.tf
+++ b/github_files.tf
@@ -27,27 +27,27 @@ resource "github_repository_file" "codeowners" {
}
}
-# data "github_repository" "template_repo" {
-# count = var.template_repo == null && var.template_repo_org == var.repo_org ? 0 : 1
-# full_name = "${var.template_repo_org == null ? "" : var.template_repo_org}/${var.template_repo == null ? "" : var.template_repo}"
-# }
+data "github_repository" "template_repo" {
+ count = var.template_repo == null && var.template_repo_org == var.repo_org ? 0 : 1
+ full_name = "${var.template_repo_org == null ? "" : var.template_repo_org}/${var.template_repo == null ? "" : var.template_repo}"
+}
-# data "github_ref" "ref" {
-# count = var.template_repo == null && var.template_repo_org == var.repo_org ? 0 : 1
-# owner = var.template_repo_org
-# repository = var.template_repo
-# ref = "heads/${element(data.github_repository.template_repo, 0).default_branch}"
-# }
+data "github_ref" "ref" {
+ count = var.template_repo == null && var.template_repo_org == var.repo_org ? 0 : 1
+ owner = var.template_repo_org
+ repository = var.template_repo
+ ref = "heads/${element(data.github_repository.template_repo, 0).default_branch}"
+}
locals {
extra_files = concat(
var.extra_files,
- # var.template_repo == null && var.template_repo_org == var.repo_org ? [] : [
- # {
- # path = ".TEMPLATE_SHA",
- # content = data.github_ref.ref[0].sha
- # }
- # ]
+ var.template_repo == null && var.template_repo_org == var.repo_org ? [] : [
+ {
+ path = ".TEMPLATE_SHA",
+ content = data.github_ref.ref[0].sha
+ }
+ ]
)
repository_name = var.create_repo ? local.github_repo.name : var.name
}