diff --git a/modules/internal_repository/README.md b/modules/internal_repository/README.md index 5fc5ef1..cd2bda2 100644 --- a/modules/internal_repository/README.md +++ b/modules/internal_repository/README.md @@ -36,6 +36,7 @@ No resources. | [dependabot\_security\_updates](#input\_dependabot\_security\_updates) | Enables dependabot security updates. Only works when `has_vulnerability_alerts` is set because that is required to enable dependabot for the repository. | `bool` | `true` | no | | [description](#input\_description) | The description to give to the repository. Defaults to `""` | `string` | `""` | no | | [environments](#input\_environments) | Environments to create for the repository. |
map(object({
wait_timer = optional(number)
can_admins_bypass = optional(bool)
prevent_self_review = optional(bool)
action_secrets = optional(map(string))
reviewers = optional(object({
teams = optional(list(string))
users = optional(list(string))
}))
deployment_branch_policy = optional(object({
protected_branches = bool
custom_branch_policies = bool
branch_patterns = list(string)
}))
})) | `{}` | no |
+| [has\_ghas\_license](#input\_has\_ghas\_license) | If the organization owning the repository has a GitHub Advanced Security license or not. Defaults to false. | `bool` | `false` | no |
| [homepage](#input\_homepage) | The homepage for the repository | `string` | `""` | no |
| [license\_template](#input\_license\_template) | The (Optional) license template to apply to the repository | `string` | `null` | no |
| [merge\_commit\_message](#input\_merge\_commit\_message) | (Optional) Can be `PR_BODY`, `PR_TITLE`, or `BLANK` for a default merge commit message. Applicable only if allow\_merge\_commit is `true`. | `string` | `"PR_TITLE"` | no |
diff --git a/modules/internal_repository/repository.tf b/modules/internal_repository/repository.tf
index c90795c..1ca7122 100644
--- a/modules/internal_repository/repository.tf
+++ b/modules/internal_repository/repository.tf
@@ -1,3 +1,7 @@
+locals {
+ enable_secret_scanning = var.has_ghas_license
+}
+
module "repository_base" {
source = "../repository_base"
@@ -29,8 +33,8 @@ module "repository_base" {
requires_web_commit_signing = var.requires_web_commit_signing
pages = var.pages
- secret_scanning = true
- secret_scanning_on_push = true
+ secret_scanning = local.enable_secret_scanning
+ secret_scanning_on_push = local.enable_secret_scanning
has_vulnerability_alerts = true
advance_security = var.advance_security
dependabot_security_updates = var.dependabot_security_updates
diff --git a/modules/internal_repository/variables.tf b/modules/internal_repository/variables.tf
index 7d5cf79..2019a8e 100644
--- a/modules/internal_repository/variables.tf
+++ b/modules/internal_repository/variables.tf
@@ -73,6 +73,12 @@ variable "advance_security" {
default = true
}
+variable "has_ghas_license" {
+ description = "If the organization owning the repository has a GitHub Advanced Security license or not. Defaults to false."
+ type = bool
+ default = false
+}
+
variable "action_secrets" {
description = "An (Optional) map of GitHub Actions secrets to create for this repository. The key is the name of the secret and the value is the encrypted value."
type = map(string)