Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(organization_settings): add github_organization_settings module #2

Open
wants to merge 3 commits into
base: actions_runner_group
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions modules/organization_settings/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# github_organization_settings

This module allows setting standard github organization settings for public profile and also for managing permissions.

<!-- BEGIN_TF_DOCS -->
<!-- prettier-ignore-start -->

## Requirements

| Name | Version |
|------|---------|
| terraform | >=1.3 |
| github | >= 6.2.3 |

## Providers

| Name | Version |
|------|---------|
| github | >= 6.2.3 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [github_organization_settings.this](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/organization_settings) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| advanced_security_enabled_for_new_repositories | Whether or not advanced security is enabled for new repositories. Defaults to false. | `bool` | `null` | no |
| billing_email | The billing email address for the organization. | `string` | n/a | yes |
| blog | The blog URL for the organization. | `string` | `null` | no |
| company | The company name for the organization. | `string` | `null` | no |
| default_repository_permission | The default permission for organization members to create new repositories. Can be one of read, write, admin, or none. Defaults to read. | `string` | `null` | no |
| dependabot_alerts_enabled_for_new_repositories | Whether or not dependabot alerts are enabled for new repositories. Defaults to false. | `bool` | `null` | no |
| dependabot_security_updates_enabled_for_new_repositories | Whether or not dependabot security updates are enabled for new repositories. Defaults to false. | `bool` | `null` | no |
| dependency_graph_enabled_for_new_repositories | Whether or not dependency graph is enabled for new repositories. Defaults to false. | `bool` | `null` | no |
| description | The description for the organization. | `string` | `null` | no |
| email | The email address for the organization. | `string` | `null` | no |
| has_organization_projects | Whether or not organization projects are enabled for the organization. | `bool` | `null` | no |
| has_repository_projects | Whether or not repository projects are enabled for the organization. | `bool` | `null` | no |
| location | The location for the organization. | `string` | `null` | no |
| members_can_create_internal_repositories | Whether or not organization members can create new internal repositories. For Enterprise Organizations only. | `bool` | `null` | no |
| members_can_create_pages | Whether or not organization members can create new pages. Defaults to true. | `bool` | `null` | no |
| members_can_create_private_pages | Whether or not organization members can create new private pages. Defaults to true. | `bool` | `null` | no |
| members_can_create_private_repositories | Whether or not organization members can create new private repositories. Defaults to true. | `bool` | `null` | no |
| members_can_create_public_pages | Whether or not organization members can create new public pages. Defaults to true. | `bool` | `null` | no |
| members_can_create_public_repositories | Whether or not organization members can create new public repositories. Defaults to true. | `bool` | `null` | no |
| members_can_create_repositories | Whether or not organization members can create new repositories. Defaults to true. | `bool` | `null` | no |
| members_can_fork_private_repositories | Whether or not organization members can fork private repositories. Defaults to false. | `bool` | `null` | no |
| name | The name for the organization. | `string` | `null` | no |
| secret_scanning_enabled_for_new_repositories | Whether or not secret scanning is enabled for new repositories. Defaults to false. | `bool` | `null` | no |
| secret_scanning_push_protection_enabled_for_new_repositories | Whether or not secret scanning push protection is enabled for new repositories. Defaults to false. | `bool` | `null` | no |
| twitter_username | The Twitter username for the organization. | `string` | `null` | no |
| web_commit_signoff_required | Whether or not commit signatures are required for commits to the organization. Defaults to false. | `bool` | `null` | no |

## Outputs

| Name | Description |
|------|-------------|
| id | The ID of the organization settings. |


## Contributing

Contributions are welcome and appreciated!

Found an issue or want to request a feature? [Open an issue](TODO)

Want to fix a bug you found or add some functionality? Fork, clone, commit, push, and PR and we'll check it out.

If you have any issues or are waiting a long time for a PR to get merged then feel free to ping us at [[email protected]](mailto:[email protected]).

## Built By

[![Masterpoint Logo](https://i.imgur.com/RDLnuQO.png)](https://masterpoint.io)

<!-- prettier-ignore-end -->
<!-- END_TF_DOCS -->
28 changes: 28 additions & 0 deletions modules/organization_settings/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
resource "github_organization_settings" "this" {
billing_email = var.billing_email
company = var.company
blog = var.blog
email = var.email
twitter_username = var.twitter_username
location = var.location
name = var.name
description = var.description
has_organization_projects = var.has_organization_projects
has_repository_projects = var.has_repository_projects
default_repository_permission = var.default_repository_permission
members_can_create_repositories = var.members_can_create_repositories
members_can_create_public_repositories = var.members_can_create_public_repositories
members_can_create_private_repositories = var.members_can_create_private_repositories
members_can_create_internal_repositories = var.members_can_create_internal_repositories
members_can_create_pages = var.members_can_create_pages
members_can_create_public_pages = var.members_can_create_public_pages
members_can_create_private_pages = var.members_can_create_private_pages
members_can_fork_private_repositories = var.members_can_fork_private_repositories
web_commit_signoff_required = var.web_commit_signoff_required
advanced_security_enabled_for_new_repositories = var.advanced_security_enabled_for_new_repositories
dependabot_alerts_enabled_for_new_repositories = var.dependabot_alerts_enabled_for_new_repositories
dependabot_security_updates_enabled_for_new_repositories = var.dependabot_security_updates_enabled_for_new_repositories
dependency_graph_enabled_for_new_repositories = var.dependency_graph_enabled_for_new_repositories
secret_scanning_enabled_for_new_repositories = var.secret_scanning_enabled_for_new_repositories
secret_scanning_push_protection_enabled_for_new_repositories = var.secret_scanning_push_protection_enabled_for_new_repositories
}
4 changes: 4 additions & 0 deletions modules/organization_settings/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "id" {
description = "The ID of the organization settings."
value = github_organization_setting.this.id
}
154 changes: 154 additions & 0 deletions modules/organization_settings/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
variable "billing_email" {
description = "The billing email address for the organization."
type = string
}

variable "company" {
description = "The company name for the organization."
type = string
default = null
}

variable "blog" {
description = "The blog URL for the organization."
type = string
default = null
}

variable "email" {
description = "The email address for the organization."
type = string
default = null
}

variable "twitter_username" {
description = "The Twitter username for the organization."
type = string
default = null
}

variable "location" {
description = "The location for the organization."
type = string
default = null
}

variable "name" {
description = "The name for the organization."
type = string
default = null
}

variable "description" {
description = "The description for the organization."
type = string
default = null
}

variable "has_organization_projects" {
description = "Whether or not organization projects are enabled for the organization."
type = bool
default = null
}

variable "has_repository_projects" {
description = "Whether or not repository projects are enabled for the organization."
type = bool
default = null
}

variable "default_repository_permission" {
description = "The default permission for organization members to create new repositories. Can be one of read, write, admin, or none. Defaults to read."
type = string
default = null
}

variable "members_can_create_repositories" {
description = "Whether or not organization members can create new repositories. Defaults to true."
type = bool
default = null
}

variable "members_can_create_public_repositories" {
description = "Whether or not organization members can create new public repositories. Defaults to true."
type = bool
default = null
}

variable "members_can_create_private_repositories" {
description = "Whether or not organization members can create new private repositories. Defaults to true."
type = bool
default = null
}

variable "members_can_create_internal_repositories" {
description = "Whether or not organization members can create new internal repositories. For Enterprise Organizations only."
type = bool
default = null
}

variable "members_can_create_pages" {
description = "Whether or not organization members can create new pages. Defaults to true."
type = bool
default = null
}

variable "members_can_create_public_pages" {
description = "Whether or not organization members can create new public pages. Defaults to true."
type = bool
default = null
}

variable "members_can_create_private_pages" {
description = "Whether or not organization members can create new private pages. Defaults to true."
type = bool
default = null
}

variable "members_can_fork_private_repositories" {
description = "Whether or not organization members can fork private repositories. Defaults to false."
type = bool
default = null
}

variable "web_commit_signoff_required" {
description = "Whether or not commit signatures are required for commits to the organization. Defaults to false."
type = bool
default = null
}

variable "advanced_security_enabled_for_new_repositories" {
description = "Whether or not advanced security is enabled for new repositories. Defaults to false."
type = bool
default = null
}

variable "dependabot_alerts_enabled_for_new_repositories" {
description = "Whether or not dependabot alerts are enabled for new repositories. Defaults to false."
type = bool
default = null
}

variable "dependabot_security_updates_enabled_for_new_repositories" {
description = "Whether or not dependabot security updates are enabled for new repositories. Defaults to false."
type = bool
default = null
}

variable "dependency_graph_enabled_for_new_repositories" {
description = "Whether or not dependency graph is enabled for new repositories. Defaults to false."
type = bool
default = null
}

variable "secret_scanning_enabled_for_new_repositories" {
description = "Whether or not secret scanning is enabled for new repositories. Defaults to false."
type = bool
default = null
}

variable "secret_scanning_push_protection_enabled_for_new_repositories" {
description = "Whether or not secret scanning push protection is enabled for new repositories. Defaults to false."
type = bool
default = null
}
9 changes: 9 additions & 0 deletions modules/organization_settings/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = ">=1.3"
required_providers {
github = {
source = "integrations/github"
version = ">= 6.2.3"
}
}
}
Loading