Skip to content

Commit 55b97cf

Browse files
committed
feat-initial-version-examples-test-built
1 parent 6caa6d8 commit 55b97cf

File tree

9 files changed

+116
-43
lines changed

9 files changed

+116
-43
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*.tfstate
66
*.tfstate.*
77

8+
# terraform lock file
9+
examples/.terraform.lock.hcl
10+
811
# Crash log files
912
crash.log
1013

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ Terraform module for creating and managing GitHub Organizations
1919
| Name | Version |
2020
|------|---------|
2121
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
22-
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.0 |
22+
| <a name="requirement_github"></a> [github](#requirement\_github) | 5.3.0 |
2323

2424
## Providers
2525

2626
| Name | Version |
2727
|------|---------|
28-
| <a name="provider_github"></a> [github](#provider\_github) | n/a |
28+
| <a name="provider_github"></a> [github](#provider\_github) | 5.3.0 |
2929

3030
## Modules
3131

@@ -35,9 +35,9 @@ No modules.
3535

3636
| Name | Type |
3737
|------|------|
38-
| [github_organization_project.this](https://registry.terraform.io/providers/hashicorp/github/latest/docs/resources/organization_project) | resource |
39-
| [github_organization_settings.this](https://registry.terraform.io/providers/hashicorp/github/latest/docs/resources/organization_settings) | resource |
40-
| [github_organization_webhook.this](https://registry.terraform.io/providers/hashicorp/github/latest/docs/resources/organization_webhook) | resource |
38+
| [github_organization_project.this](https://registry.terraform.io/providers/integrations/github/5.3.0/docs/resources/organization_project) | resource |
39+
| [github_organization_settings.this](https://registry.terraform.io/providers/integrations/github/5.3.0/docs/resources/organization_settings) | resource |
40+
| [github_organization_webhook.this](https://registry.terraform.io/providers/integrations/github/5.3.0/docs/resources/organization_webhook) | resource |
4141

4242
## Inputs
4343

@@ -57,9 +57,12 @@ No modules.
5757
| <a name="input_description"></a> [description](#input\_description) | The description for the GitHub Organization. (Optional) | `string` | `""` | no |
5858
| <a name="input_email"></a> [email](#input\_email) | The email address (example@example.com) for the GitHub Organization. (Optional) | `string` | `""` | no |
5959
| <a name="input_github_organization_project_body"></a> [github\_organization\_project\_body](#input\_github\_organization\_project\_body) | The body of the project. (Optional) | `string` | `""` | no |
60-
| <a name="input_github_organization_project_name"></a> [github\_organization\_project\_name](#input\_github\_organization\_project\_name) | The name of the project. (Required) | `string` | n/a | yes |
60+
| <a name="input_github_organization_project_name"></a> [github\_organization\_project\_name](#input\_github\_organization\_project\_name) | The name of the project. (Required) | `string` | `""` | no |
6161
| <a name="input_github_organization_webhook_active"></a> [github\_organization\_webhook\_active](#input\_github\_organization\_webhook\_active) | Indicate of the webhook should receive events. (Optional) | `bool` | `true` | no |
62-
| <a name="input_github_organization_webhook_config"></a> [github\_organization\_webhook\_config](#input\_github\_organization\_webhook\_config) | Map containing the config for this webhook. (Required) | `map(string)` | `{}` | no |
62+
| <a name="input_github_organization_webhook_config_content_type"></a> [github\_organization\_webhook\_config\_content\_type](#input\_github\_organization\_webhook\_config\_content\_type) | The content type of the webhook. [form\|json] | `string` | `"form"` | no |
63+
| <a name="input_github_organization_webhook_config_insecure_ssl"></a> [github\_organization\_webhook\_config\_insecure\_ssl](#input\_github\_organization\_webhook\_config\_insecure\_ssl) | Whether to allow insecure\_ssl. | `bool` | `false` | no |
64+
| <a name="input_github_organization_webhook_config_secret"></a> [github\_organization\_webhook\_config\_secret](#input\_github\_organization\_webhook\_config\_secret) | Secret for the Webhook | `string` | `""` | no |
65+
| <a name="input_github_organization_webhook_config_url"></a> [github\_organization\_webhook\_config\_url](#input\_github\_organization\_webhook\_config\_url) | The URL of the webhook | `string` | `""` | no |
6366
| <a name="input_github_organization_webhook_events"></a> [github\_organization\_webhook\_events](#input\_github\_organization\_webhook\_events) | A list of events which should trigger the webhook. (Optional)<br>For list of valid events, visit https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#issues | `list(any)` | `[]` | no |
6467
| <a name="input_has_organization_projects"></a> [has\_organization\_projects](#input\_has\_organization\_projects) | Whether or not organization projects are enabled for the GitHub Organization. (Optional) | `bool` | `true` | no |
6568
| <a name="input_has_repository_projects"></a> [has\_repository\_projects](#input\_has\_repository\_projects) | Whether or not repository projects are enabled for the GitHub Organization. (Optional) | `bool` | `true` | no |

examples/README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,21 @@ No providers.
3434

3535
| Name | Source | Version |
3636
|------|--------|---------|
37-
| <a name="module_template_null_resource"></a> [template\_null\_resource](#module\_template\_null\_resource) | ../ | n/a |
37+
| <a name="module_github_organization_settings"></a> [github\_organization\_settings](#module\_github\_organization\_settings) | ../ | n/a |
3838

3939
## Resources
4040

4141
No resources.
4242

4343
## Inputs
4444

45-
No inputs.
45+
| Name | Description | Type | Default | Required |
46+
|------|-------------|------|---------|:--------:|
47+
| <a name="input_billing_email"></a> [billing\_email](#input\_billing\_email) | The billing email address for the GitHub Organization. (Required) | `string` | n/a | yes |
48+
| <a name="input_owner"></a> [owner](#input\_owner) | Target GitHub organization or individual user account to manage. (Required) | `string` | n/a | yes |
49+
| <a name="input_token"></a> [token](#input\_token) | GitHub API Auth using OAuth or Personal Access Token. (Required) | `string` | n/a | yes |
4650

4751
## Outputs
4852

49-
| Name | Description |
50-
|------|-------------|
51-
| <a name="output_template_null_resource_id"></a> [template\_null\_resource\_id](#output\_template\_null\_resource\_id) | The ID of the null resource |
53+
No outputs.
5254
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/deploy.tf

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
provider "github" {
2-
owner = "dsodk-test"
2+
3+
owner = var.owner
4+
token = var.token
35

46
#token = var.github_token # GITHUB_TOKEN - GitHub API Auth using OAuth or Personal Access Token
57
#base_url = var.github_base_url # GITHUB_BASE_URL - Target GitHub base API endpoint. Required for GitHub Enterprise
@@ -10,14 +12,30 @@ provider "github" {
1012
}
1113

1214
##################################################
13-
# Null Resource Module
15+
# GitHub Organization
1416
##################################################
1517

16-
module "template_null_resource" {
18+
module "github_organization_settings" {
1719
source = "../"
1820

19-
triggers = {
20-
name = "dsodk-template-code-terraform-module"
21-
trigger = "Change this text to trigger the module to replace null resources with new ones"
22-
}
21+
billing_email = var.billing_email
22+
company = "dsodk"
23+
email = "terraform.module.test@dsodk.io"
24+
location = "Global"
25+
name = "dsodk-test-github-org-module"
26+
description = "Test organization used by example in dsodk-code-module-terraform-github-organization"
27+
28+
default_repository_permission = "read"
29+
30+
members_can_create_repositories = false
31+
members_can_create_public_repositories = false
32+
members_can_create_private_repositories = false
33+
34+
members_can_create_pages = false
35+
members_can_create_public_pages = false
36+
members_can_create_private_pages = false
37+
members_can_fork_private_repositories = false
38+
39+
secret_scanning_enabled_for_new_repositories = true
40+
secret_scanning_push_protection_enabled_for_new_repositories = true
2341
}

examples/outputs.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
output "template_null_resource_id" {
2-
description = "The ID of the null resource"
3-
value = module.template_null_resource.template_null_resource_id
4-
}

examples/variables.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
##################################################
2+
# GitHub Provider Config
3+
##################################################
4+
5+
variable "owner" {
6+
description = "Target GitHub organization or individual user account to manage. (Required)"
7+
type = string
8+
}
9+
10+
variable "token" {
11+
description = "GitHub API Auth using OAuth or Personal Access Token. (Required)"
12+
type = string
13+
sensitive = true
14+
}
15+
16+
##################################################
17+
# GitHub Organization
18+
##################################################
19+
20+
variable "billing_email" {
21+
description = "The billing email address for the GitHub Organization. (Required)"
22+
type = string
23+
sensitive = true
24+
}

main.tf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,14 @@ resource "github_organization_project" "this" {
5353
resource "github_organization_webhook" "this" {
5454
count = var.create_github_organization && var.create_github_organization_webhook ? 1 : 0
5555

56-
events = var.github_organization_webhook_events
57-
configuration = var.github_organization_webhook_config
56+
events = var.github_organization_webhook_events
57+
58+
configuration {
59+
url = var.github_organization_webhook_config_url
60+
content_type = var.github_organization_webhook_config_content_type
61+
insecure_ssl = var.github_organization_webhook_config_insecure_ssl
62+
secret = var.github_organization_webhook_config_secret
63+
}
5864

5965
active = var.github_organization_webhook_active
60-
name = "web" # This is the type of hook. "web" is the default and only option.
6166
}

variables.tf

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ variable "create_github_organization_project" {
176176
variable "github_organization_project_name" {
177177
description = "The name of the project. (Required)"
178178
type = string
179+
default = ""
179180
}
180181

181182
variable "github_organization_project_body" {
@@ -194,16 +195,41 @@ variable "create_github_organization_webhook" {
194195
default = false
195196
}
196197

197-
variable "github_organization_webhook_config" {
198-
description = "Map containing the config for this webhook. (Required)"
199-
type = map(string)
200-
default = {}
201-
#type = object({
202-
# url = (string),
203-
# content_type = (string, form), # [form|json]
204-
# insecure_ssl = (bool, false)
205-
# secret = optional(string)
206-
#})
198+
#variable "github_organization_webhook_config" {
199+
# description = "Map containing the config for this webhook. (Required)"
200+
# type = map(string)
201+
# default = {}
202+
# #type = object({
203+
# # url = (string),
204+
# # content_type = (string, form), # [form|json]
205+
# # insecure_ssl = (bool, false)
206+
# # secret = optional(string)
207+
# #})
208+
#}
209+
210+
variable "github_organization_webhook_config_url" {
211+
description = "The URL of the webhook"
212+
type = string
213+
default = ""
214+
}
215+
216+
variable "github_organization_webhook_config_content_type" {
217+
description = "The content type of the webhook. [form|json]"
218+
type = string
219+
default = "form"
220+
}
221+
222+
variable "github_organization_webhook_config_insecure_ssl" {
223+
description = "Whether to allow insecure_ssl."
224+
type = bool
225+
default = false
226+
}
227+
228+
variable "github_organization_webhook_config_secret" {
229+
description = "Secret for the Webhook"
230+
type = string
231+
default = ""
232+
sensitive = true
207233
}
208234

209235
variable "github_organization_webhook_active" {

versions.tf

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@ terraform {
22
required_version = ">= 1.0"
33

44
required_providers {
5-
# aws = {
6-
# source = "hashicorp/aws"
7-
# version = ">= 4.0"
8-
# },
9-
null = {
10-
source = "hashicorp/null"
11-
version = ">= 3.0"
5+
github = {
6+
source = "integrations/github"
7+
version = "5.3.0"
128
}
139
}
1410
}

0 commit comments

Comments
 (0)