-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from FociSolutions/custom-roles
Adds custom repository roles to organization layer
- Loading branch information
Showing
19 changed files
with
226 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
output "ghas_enabled" { | ||
value = github_organization_settings.organization_settings.advanced_security_enabled_for_new_repositories | ||
description = "A boolean value indicating if GitHub Advanced Security is enabled for new repositories in the organization." | ||
} | ||
|
||
output "custom_role_ids" { | ||
value = { | ||
for role in github_organization_custom_role.custom_repository_role : role.name => role.id | ||
} | ||
description = "A map of custom role names to custom role ids." | ||
} | ||
|
||
output "security_engineer_role_id" { | ||
value = length(github_organization_custom_role.security_engineer_role) > 0 ? github_organization_custom_role.security_engineer_role[0].id : null | ||
description = "The id of the security engineer custom role." | ||
} | ||
|
||
output "contractor_role_id" { | ||
value = length(github_organization_custom_role.contractor_role) > 0 ? github_organization_custom_role.contractor_role[0].id : null | ||
description = "The id of the contractor custom role." | ||
} | ||
|
||
output "community_manager_role_id" { | ||
value = length(github_organization_custom_role.community_manager_role) > 0 ? github_organization_custom_role.community_manager_role[0].id : null | ||
description = "The id of the community manager custom role." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
resource "github_organization_custom_role" "custom_repository_role" { | ||
for_each = var.custom_repository_roles | ||
name = each.key | ||
description = each.value.description | ||
base_role = each.value.base_role | ||
permissions = each.value.permissions | ||
|
||
lifecycle { | ||
precondition { | ||
condition = length(var.custom_repository_roles) <= 5 - (var.enable_security_engineer_role ? 1 : 0) - (var.enable_contractor_role ? 1 : 0) - (var.enable_community_manager_role ? 1 : 0) | ||
error_message = "To many custom repository roles defined, an orrganization's maximum is 5. This limit is reduced by one for each of the following variables that are set to true: `enable_security_engineer_role`, `enable_contractor_role`, `enable_community_manager_role`." | ||
} | ||
} | ||
} | ||
|
||
resource "github_organization_custom_role" "security_engineer_role" { | ||
count = var.enable_security_engineer_role ? 1 : 0 | ||
name = "Security Engineer" | ||
description = "Security Engineers have maintainer permissions and are able to contribute code and maintain the security pipeline." | ||
base_role = "maintain" | ||
permissions = [ | ||
"delete_alerts_code_scanning", | ||
"write_code_scanning" | ||
] | ||
} | ||
|
||
resource "github_organization_custom_role" "contractor_role" { | ||
count = var.enable_contractor_role ? 1 : 0 | ||
name = "Contractor" | ||
description = "Contractors have write permissions and are able to develop webhooks integrations." | ||
base_role = "write" | ||
permissions = [ | ||
"manage_webhooks" | ||
] | ||
} | ||
|
||
resource "github_organization_custom_role" "community_manager_role" { | ||
count = var.enable_community_manager_role ? 1 : 0 | ||
name = "Community Manager" | ||
description = "Community Managers have read permissions and are able to handle all the community interactions without being able to contribute code." | ||
base_role = "read" | ||
permissions = [ | ||
"mark_as_duplicate", | ||
"manage_settings_pages", | ||
"manage_settings_wiki", | ||
"set_social_preview", | ||
"edit_repo_metadata", | ||
"edit_discussion_category", | ||
"create_discussion_category", | ||
"edit_category_on_discussion", | ||
"toggle_discussion_answer", | ||
"convert_issues_to_discussions", | ||
"close_discussion", | ||
"reopen_discussion", | ||
"delete_discussion_comment" | ||
] | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
organizations/tools/gh_foundations/internal/pkg/functions/files.go
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.