Skip to content

Commit 39648f9

Browse files
authored
Merge pull request #44 from FociSolutions/43-bug-non-enterprise-bootstrap-fail
fix: don't use rulesets for non-enterprise accounts
2 parents 908bbf7 + 01f25fa commit 39648f9

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

modules/github-foundations/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646

4747
| Name | Description | Type | Default | Required |
4848
|------|-------------|------|---------|:--------:|
49+
| <a name="input_account_type"></a> [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 |
4950
| <a name="input_bootstrap_repository_name"></a> [bootstrap\_repository\_name](#input\_bootstrap\_repository\_name) | The name of the bootstrap repository. | `string` | `"bootstrap"` | no |
5051
| <a name="input_foundation_devs_team_name"></a> [foundation\_devs\_team\_name](#input\_foundation\_devs\_team\_name) | The name of the foundation developers team. | `string` | `"foundation-devs"` | no |
5152
| <a name="input_oidc_configuration"></a> [oidc\_configuration](#input\_oidc\_configuration) | n/a | <pre>object({<br> gcp = optional(object({<br> workload_identity_provider_name_secret_name = optional(string)<br> workload_identity_provider_name = string<br><br> organization_workload_identity_sa_secret_name = optional(string)<br> organization_workload_identity_sa = string<br><br> gcp_secret_manager_project_id_variable_name = optional(string)<br> gcp_secret_manager_project_id = string<br><br> gcp_tf_state_bucket_project_id_variable_name = optional(string)<br> gcp_tf_state_bucket_project_id = string<br><br> bucket_name_variable_name = optional(string)<br> bucket_name = string<br><br> bucket_location_variable_name = optional(string)<br> bucket_location = string<br> }))<br> custom = optional(object({<br> organization_secrets = map(string)<br> organization_variables = map(string)<br> repository_secrets = map(map(string))<br> repository_variables = map(map(string))<br> }))<br> })</pre> | n/a | yes |

modules/github-foundations/rulesets.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module "base_ruleset" {
22
source = "../ruleset"
3+
count = var.account_type == "Enterprise" ? 1 : 0
34

45
name = "Foundation Repositories Base Ruleset"
56
enforcement = "active"
@@ -16,4 +17,4 @@ module "base_ruleset" {
1617

1718
ref_name_inclusions = ["~DEFAULT_BRANCH"]
1819
repository_name_inclusions = [github_repository.bootstrap_repo.name, github_repository.organizations_repo.name]
19-
}
20+
}

modules/github-foundations/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,13 @@ variable "oidc_configuration" {
5555
error_message = "At least one oidc_configuration must be set."
5656
}
5757
}
58+
59+
variable "account_type" {
60+
type = string
61+
description = "The type of GitHub account being used. Should be one of either `Personal`, `Organization`, or `Enterprise`."
62+
63+
validation {
64+
condition = contains(["Personal", "Organization", "Enterprise"], var.account_type)
65+
error_message = "The account type must be either `Personal`, `Organization`, or `Enterprise`."
66+
}
67+
}

0 commit comments

Comments
 (0)