diff --git a/modules/private_repository/README.md b/modules/private_repository/README.md index f810a54..f76df21 100644 --- a/modules/private_repository/README.md +++ b/modules/private_repository/README.md @@ -34,10 +34,11 @@ No resources. | [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({
action_secrets = optional(map(string))
})) | `{}` | no |
| [homepage](#input\_homepage) | The homepage for the repository | `string` | `""` | no |
+| [license\_template](#input\_license\_template) | The (Optional) license template to use for the repository | `string` | `null` | no |
| [name](#input\_name) | The name of the repository to create/import. | `string` | n/a | yes |
| [protected\_branches](#input\_protected\_branches) | A list of ref names or patterns that should be protected. Defaults `["main"]` | `list(string)` | [| no | | [repository\_team\_permissions](#input\_repository\_team\_permissions) | A map where the keys are github team slugs and the value is the permissions the team should have in the repository | `map(string)` | n/a | yes | -| [template\_repository](#input\_template\_repository) | A list of template repositories to use for the repository |
"main"
]
object({
owner = string
repository = string
include_all_branches = bool
}) | `null` | no |
+| [template\_repository](#input\_template\_repository) | A (Optional) list of template repositories to use for the repository | object({
owner = string
repository = string
include_all_branches = bool
}) | `null` | no |
| [topics](#input\_topics) | The topics to apply to the repository | `list(string)` | `[]` | no |
## Outputs
diff --git a/modules/private_repository/repository.tf b/modules/private_repository/repository.tf
index b1d6310..e95445b 100644
--- a/modules/private_repository/repository.tf
+++ b/modules/private_repository/repository.tf
@@ -32,4 +32,5 @@ module "repository_base" {
environments = var.environments
template_repository = var.template_repository
+ license_template = var.license_template
}
diff --git a/modules/private_repository/variables.tf b/modules/private_repository/variables.tf
index f566d3e..b9a111a 100644
--- a/modules/private_repository/variables.tf
+++ b/modules/private_repository/variables.tf
@@ -89,11 +89,17 @@ variable "environments" {
}
variable "template_repository" {
- description = "A list of template repositories to use for the repository"
+ description = "A (Optional) list of template repositories to use for the repository"
type = object({
owner = string
repository = string
include_all_branches = bool
})
default = null
+}
+
+variable "license_template" {
+ description = "The (Optional) license template to use for the repository"
+ type = string
+ default = null
}
\ No newline at end of file
diff --git a/modules/public_repository/README.md b/modules/public_repository/README.md
index a5909d7..2b1af93 100644
--- a/modules/public_repository/README.md
+++ b/modules/public_repository/README.md
@@ -34,10 +34,11 @@ No resources.
| [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({
action_secrets = optional(map(string))
})) | `{}` | 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 |
| [name](#input\_name) | The name of the repository to create/import. | `string` | n/a | yes |
| [protected\_branches](#input\_protected\_branches) | A list of ref names or patterns that should be protected. Defaults `["main"]` | `list(string)` | [| no | | [repository\_team\_permissions](#input\_repository\_team\_permissions) | A map where the keys are github team slugs and the value is the permissions the team should have in the repository | `map(string)` | n/a | yes | -| [template\_repository](#input\_template\_repository) | A list of template repositories to use for the repository |
"main"
]
object({
owner = string
repository = string
include_all_branches = bool
}) | `null` | no |
+| [template\_repository](#input\_template\_repository) | A (Optional) list of template repositories to use for the repository | object({
owner = string
repository = string
include_all_branches = bool
}) | `null` | no |
| [topics](#input\_topics) | The topics to apply to the repository | `list(string)` | `[]` | no |
## Outputs
diff --git a/modules/public_repository/repository.tf b/modules/public_repository/repository.tf
index 9ee5630..7eb7e5e 100644
--- a/modules/public_repository/repository.tf
+++ b/modules/public_repository/repository.tf
@@ -32,4 +32,5 @@ module "repository_base" {
environments = var.environments
template_repository = var.template_repository
+ license_template = var.license_template
}
\ No newline at end of file
diff --git a/modules/public_repository/variables.tf b/modules/public_repository/variables.tf
index 7920be8..3e84e32 100644
--- a/modules/public_repository/variables.tf
+++ b/modules/public_repository/variables.tf
@@ -89,11 +89,17 @@ variable "environments" {
}
variable "template_repository" {
- description = "A list of template repositories to use for the repository"
+ description = "A (Optional) list of template repositories to use for the repository"
type = object({
owner = string
repository = string
include_all_branches = bool
})
default = null
+}
+
+variable "license_template" {
+ description = "The (Optional) license template to apply to the repository"
+ type = string
+ default = null
}
\ No newline at end of file
diff --git a/modules/repository_base/README.md b/modules/repository_base/README.md
index 2240c6b..c5d93de 100644
--- a/modules/repository_base/README.md
+++ b/modules/repository_base/README.md
@@ -51,12 +51,13 @@ No modules.
| [has\_vulnerability\_alerts](#input\_has\_vulnerability\_alerts) | Enables security alerts for vulnerable dependencies for the repository | `bool` | `true` | no |
| [has\_wiki](#input\_has\_wiki) | Enables Github Wiki for the repository | `bool` | `true` | no |
| [homepage](#input\_homepage) | The homepage for the repository | `string` | `""` | no |
+| [license\_template](#input\_license\_template) | The (Optional) license template to use for the repository | `string` | `null` | no |
| [name](#input\_name) | The name of the repository to create/import. | `string` | n/a | yes |
| [protected\_branches](#input\_protected\_branches) | A list of ref names or patterns that should be protected. Setting to `[]` means no protection. Defaults `["~DEFAULT_BRANCH"]` | `list(string)` | [| no | | [repository\_team\_permissions](#input\_repository\_team\_permissions) | A map where the keys are github team slugs and the value is the permissions the team should have in the repository | `map(string)` | n/a | yes | | [secret\_scanning](#input\_secret\_scanning) | Enables secret scanning for the repository. If repository is private `advance_security` must also be enabled. | `bool` | `true` | no | | [secret\_scanning\_on\_push](#input\_secret\_scanning\_on\_push) | Enables secret scanning push protection for the repository. If repository is private `advance_security` must also be enabled. | `bool` | `true` | no | -| [template\_repository](#input\_template\_repository) | A list of template repositories to use for the repository |
"~DEFAULT_BRANCH"
]
object({
owner = string
repository = string
include_all_branches = bool
}) | `null` | no |
+| [template\_repository](#input\_template\_repository) | A (Optional) list of template repositories to use for the repository | object({
owner = string
repository = string
include_all_branches = bool
}) | `null` | no |
| [topics](#input\_topics) | The topics to apply to the repository | `list(string)` | `[]` | no |
| [visibility](#input\_visibility) | Sets the visibility property of a repository. Defaults to "private" | `string` | `"private"` | no |
diff --git a/modules/repository_base/repository.tf b/modules/repository_base/repository.tf
index c2cac64..b67e2a7 100644
--- a/modules/repository_base/repository.tf
+++ b/modules/repository_base/repository.tf
@@ -25,6 +25,8 @@ resource "github_repository" "repository" {
homepage_url = var.homepage
delete_branch_on_merge = var.delete_head_on_merge
allow_auto_merge = var.allow_auto_merge
+ license_template = var.license_template
+
# A hacky way of getting around the 422 errors received from github api
dynamic "security_and_analysis" {
diff --git a/modules/repository_base/variables.tf b/modules/repository_base/variables.tf
index dc33685..a9a2f0d 100644
--- a/modules/repository_base/variables.tf
+++ b/modules/repository_base/variables.tf
@@ -143,11 +143,17 @@ variable "environments" {
}
variable "template_repository" {
- description = "A list of template repositories to use for the repository"
+ description = "A (Optional) list of template repositories to use for the repository"
type = object({
owner = string
repository = string
include_all_branches = bool
})
default = null
+}
+
+variable "license_template" {
+ description = "The (Optional) license template to use for the repository"
+ type = string
+ default = null
}
\ No newline at end of file
diff --git a/modules/repository_set/README.md b/modules/repository_set/README.md
index 0584132..ae5af00 100644
--- a/modules/repository_set/README.md
+++ b/modules/repository_set/README.md
@@ -25,8 +25,8 @@ No resources.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [default\_repository\_team\_permissions](#input\_default\_repository\_team\_permissions) | A map where the keys are github team slugs and the value is the permissions the team should have by default for every repository. If an entry exists in `repository_team_permissions_override` for a repository then that will take precedence over this default. | `map(string)` | n/a | yes |
-| [private\_repositories](#input\_private\_repositories) | A map of private repositories where the key is the repository name and the value is the configuration | map(object({
description = string
default_branch = string
repository_team_permissions_override = map(string)
protected_branches = list(string)
advance_security = bool
has_vulnerability_alerts = bool
topics = list(string)
homepage = string
delete_head_on_merge = bool
allow_auto_merge = bool
dependabot_security_updates = bool
action_secrets = optional(map(string))
codespace_secrets = optional(map(string))
dependabot_secrets = optional(map(string))
environments = optional(map(object({
action_secrets = optional(map(string))
})))
template_repository = optional(object({
owner = string
repository = string
include_all_branches = bool
}))
})) | n/a | yes |
-| [public\_repositories](#input\_public\_repositories) | A map of public repositories where the key is the repository name and the value is the configuration | map(object({
description = string
default_branch = string
repository_team_permissions_override = map(string)
protected_branches = list(string)
advance_security = bool
topics = list(string)
homepage = string
delete_head_on_merge = bool
allow_auto_merge = bool
dependabot_security_updates = bool
action_secrets = optional(map(string))
codespace_secrets = optional(map(string))
dependabot_secrets = optional(map(string))
environments = optional(map(object({
action_secrets = optional(map(string))
})))
template_repository = optional(object({
owner = string
repository = string
include_all_branches = bool
}))
})) | n/a | yes |
+| [private\_repositories](#input\_private\_repositories) | A map of private repositories where the key is the repository name and the value is the configuration | map(object({
description = string
default_branch = string
repository_team_permissions_override = map(string)
protected_branches = list(string)
advance_security = bool
has_vulnerability_alerts = bool
topics = list(string)
homepage = string
delete_head_on_merge = bool
allow_auto_merge = bool
dependabot_security_updates = bool
action_secrets = optional(map(string))
codespace_secrets = optional(map(string))
dependabot_secrets = optional(map(string))
environments = optional(map(object({
action_secrets = optional(map(string))
})))
template_repository = optional(object({
owner = string
repository = string
include_all_branches = bool
}))
license_template = optional(string)
})) | n/a | yes |
+| [public\_repositories](#input\_public\_repositories) | A map of public repositories where the key is the repository name and the value is the configuration | map(object({
description = string
default_branch = string
repository_team_permissions_override = map(string)
protected_branches = list(string)
advance_security = bool
topics = list(string)
homepage = string
delete_head_on_merge = bool
allow_auto_merge = bool
dependabot_security_updates = bool
action_secrets = optional(map(string))
codespace_secrets = optional(map(string))
dependabot_secrets = optional(map(string))
environments = optional(map(object({
action_secrets = optional(map(string))
})))
template_repository = optional(object({
owner = string
repository = string
include_all_branches = bool
}))
license_template = optional(string)
})) | n/a | yes |
## Outputs
diff --git a/modules/repository_set/repositories.tf b/modules/repository_set/repositories.tf
index 6b15ea1..af80a83 100644
--- a/modules/repository_set/repositories.tf
+++ b/modules/repository_set/repositories.tf
@@ -19,6 +19,7 @@ module "public_repositories" {
dependabot_secrets = each.value.dependabot_secrets
environments = each.value.environments
template_repository = each.value.template_repository
+ license_template = each.value.license_template
}
module "private_repositories" {
@@ -42,4 +43,5 @@ module "private_repositories" {
dependabot_secrets = each.value.dependabot_secrets
environments = each.value.environments
template_repository = each.value.template_repository
+ license_template = each.value.license_template
}
diff --git a/modules/repository_set/variables.tf b/modules/repository_set/variables.tf
index 692ee9f..6bf4bb2 100644
--- a/modules/repository_set/variables.tf
+++ b/modules/repository_set/variables.tf
@@ -22,6 +22,7 @@ variable "private_repositories" {
repository = string
include_all_branches = bool
}))
+ license_template = optional(string)
}))
description = "A map of private repositories where the key is the repository name and the value is the configuration"
}
@@ -49,6 +50,7 @@ variable "public_repositories" {
repository = string
include_all_branches = bool
}))
+ license_template = optional(string)
}))
description = "A map of public repositories where the key is the repository name and the value is the configuration"
}