-
-
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.
- Loading branch information
Showing
8 changed files
with
189 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# enterprise-organization | ||
|
||
This module creates following resources. | ||
|
||
- `github_membership` (optional) | ||
- `github_organization_block` (optional) | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.6 | | ||
| <a name="requirement_github"></a> [github](#requirement\_github) | >= 6.2 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_github"></a> [github](#provider\_github) | 6.2.1 | | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [github_enterprise_organization.this](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/enterprise_organization) | resource | | ||
| [github_enterprise.this](https://registry.terraform.io/providers/integrations/github/latest/docs/data-sources/enterprise) | data source | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_billing_email"></a> [billing\_email](#input\_billing\_email) | (Required) The billing email address. | `string` | n/a | yes | | ||
| <a name="input_enterprise"></a> [enterprise](#input\_enterprise) | (Required) The name (slug) of the enterprise. | `string` | n/a | yes | | ||
| <a name="input_name"></a> [name](#input\_name) | (Required) The name of the organization. | `string` | n/a | yes | | ||
| <a name="input_description"></a> [description](#input\_description) | (Optional) The description of the organization. | `string` | `"Managed by Terraform."` | no | | ||
| <a name="input_display_name"></a> [display\_name](#input\_display\_name) | (Optional) The display name of the organization. If not set, the `name` will be used as the `display_name`. | `string` | `""` | no | | ||
| <a name="input_owners"></a> [owners](#input\_owners) | (Optional) A list of usernames to add users as `owner` role. | `set(string)` | `[]` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_billing_email"></a> [billing\_email](#output\_billing\_email) | The billing email address. | | ||
| <a name="output_database_id"></a> [database\_id](#output\_database\_id) | The database ID of the organization. | | ||
| <a name="output_description"></a> [description](#output\_description) | The description of the organization. | | ||
| <a name="output_display_name"></a> [display\_name](#output\_display\_name) | The display name of the organization. | | ||
| <a name="output_enterprise"></a> [enterprise](#output\_enterprise) | The information of the enterprise which the organization belongs to. | | ||
| <a name="output_id"></a> [id](#output\_id) | The ID of the organization. | | ||
| <a name="output_name"></a> [name](#output\_name) | The name of the organization. | | ||
| <a name="output_owners"></a> [owners](#output\_owners) | A list of organization owner usernames. | | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
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,19 @@ | ||
data "github_enterprise" "this" { | ||
slug = var.enterprise | ||
} | ||
|
||
|
||
################################################### | ||
# Organization of GitHub Enterprise | ||
################################################### | ||
|
||
resource "github_enterprise_organization" "this" { | ||
enterprise_id = data.github_enterprise.this.id | ||
|
||
name = var.name | ||
display_name = coalesce(var.display_name, var.name) | ||
description = var.description | ||
|
||
admin_logins = var.owners | ||
billing_email = var.billing_email | ||
} |
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,50 @@ | ||
output "enterprise" { | ||
description = "The information of the enterprise which the organization belongs to." | ||
value = { | ||
id = github_enterprise_organization.this.enterprise_id | ||
name = var.enterprise | ||
} | ||
} | ||
|
||
output "id" { | ||
description = "The ID of the organization." | ||
value = github_enterprise_organization.this.id | ||
} | ||
|
||
output "database_id" { | ||
description = "The database ID of the organization." | ||
value = github_enterprise_organization.this.database_id | ||
} | ||
|
||
output "name" { | ||
description = "The name of the organization." | ||
value = github_enterprise_organization.this.name | ||
} | ||
|
||
output "display_name" { | ||
description = "The display name of the organization." | ||
value = github_enterprise_organization.this.display_name | ||
} | ||
|
||
output "description" { | ||
description = "The description of the organization." | ||
value = github_enterprise_organization.this.description | ||
} | ||
|
||
output "owners" { | ||
description = "A list of organization owner usernames." | ||
value = github_enterprise_organization.this.admin_logins | ||
} | ||
|
||
output "billing_email" { | ||
description = "The billing email address." | ||
value = github_enterprise_organization.this.billing_email | ||
} | ||
|
||
# output "debug" { | ||
# value = { | ||
# for k, v in github_enterprise_organization.this : | ||
# k => v | ||
# if !contains(["id", "name", "display_name", "description", "admin_logins", "billing_email", "database_id", "enterprise_id"], k) | ||
# } | ||
# } |
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,38 @@ | ||
variable "enterprise" { | ||
description = "(Required) The name (slug) of the enterprise." | ||
type = string | ||
nullable = false | ||
} | ||
|
||
variable "name" { | ||
description = "(Required) The name of the organization." | ||
type = string | ||
nullable = false | ||
} | ||
|
||
variable "display_name" { | ||
description = "(Optional) The display name of the organization. If not set, the `name` will be used as the `display_name`." | ||
type = string | ||
default = "" | ||
nullable = false | ||
} | ||
|
||
variable "description" { | ||
description = "(Optional) The description of the organization." | ||
type = string | ||
default = "Managed by Terraform." | ||
nullable = false | ||
} | ||
|
||
variable "owners" { | ||
description = "(Optional) A list of usernames to add users as `owner` role." | ||
type = set(string) | ||
default = [] | ||
nullable = false | ||
} | ||
|
||
variable "billing_email" { | ||
description = "(Required) The billing email address." | ||
type = string | ||
nullable = false | ||
} |
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,10 @@ | ||
terraform { | ||
required_version = ">= 1.6" | ||
|
||
required_providers { | ||
github = { | ||
source = "integrations/github" | ||
version = ">= 6.2" | ||
} | ||
} | ||
} |