diff --git a/modules/github-foundations/README.md b/modules/github-foundations/README.md index c5ed838..c5c70c7 100644 --- a/modules/github-foundations/README.md +++ b/modules/github-foundations/README.md @@ -46,6 +46,7 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| [account\_type](#input\_account\_type) | The type of GitHub account being used. Should be one of either `Personal`, `Organization`, or `Enterprise`. | `string` | n/a | yes | | [bootstrap\_repository\_name](#input\_bootstrap\_repository\_name) | The name of the bootstrap repository. | `string` | `"bootstrap"` | no | | [foundation\_devs\_team\_name](#input\_foundation\_devs\_team\_name) | The name of the foundation developers team. | `string` | `"foundation-devs"` | no | | [oidc\_configuration](#input\_oidc\_configuration) | n/a |
object({
gcp = optional(object({
workload_identity_provider_name_secret_name = optional(string)
workload_identity_provider_name = string

organization_workload_identity_sa_secret_name = optional(string)
organization_workload_identity_sa = string

gcp_secret_manager_project_id_variable_name = optional(string)
gcp_secret_manager_project_id = string

gcp_tf_state_bucket_project_id_variable_name = optional(string)
gcp_tf_state_bucket_project_id = string

bucket_name_variable_name = optional(string)
bucket_name = string

bucket_location_variable_name = optional(string)
bucket_location = string
}))
custom = optional(object({
organization_secrets = map(string)
organization_variables = map(string)
repository_secrets = map(map(string))
repository_variables = map(map(string))
}))
})
| n/a | yes | diff --git a/modules/github-foundations/rulesets.tf b/modules/github-foundations/rulesets.tf index 22fbadf..2651289 100644 --- a/modules/github-foundations/rulesets.tf +++ b/modules/github-foundations/rulesets.tf @@ -1,5 +1,6 @@ module "base_ruleset" { source = "../ruleset" + count = var.account_type == "Enterprise" ? 1 : 0 name = "Foundation Repositories Base Ruleset" enforcement = "active" @@ -16,4 +17,4 @@ module "base_ruleset" { ref_name_inclusions = ["~DEFAULT_BRANCH"] repository_name_inclusions = [github_repository.bootstrap_repo.name, github_repository.organizations_repo.name] -} \ No newline at end of file +} diff --git a/modules/github-foundations/variables.tf b/modules/github-foundations/variables.tf index b471c6d..fe9583e 100644 --- a/modules/github-foundations/variables.tf +++ b/modules/github-foundations/variables.tf @@ -55,3 +55,13 @@ variable "oidc_configuration" { error_message = "At least one oidc_configuration must be set." } } + +variable "account_type" { + type = string + description = "The type of GitHub account being used. Should be one of either `Personal`, `Organization`, or `Enterprise`." + + validation { + condition = contains(["Personal", "Organization", "Enterprise"], var.account_type) + error_message = "The account type must be either `Personal`, `Organization`, or `Enterprise`." + } +}