Skip to content

Commit f48fb14

Browse files
authored
Merge pull request #3 from dsodk/feat-breakout-module-into-submodules
feat-breakout-module-into-submodules
2 parents a46194e + 53028fc commit f48fb14

File tree

20 files changed

+310
-32
lines changed

20 files changed

+310
-32
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# DSODK - Terraform Module for GitHub Organizations
1+
# DSODK - Terraform Module for GitHub
22

33
Terraform module for creating and managing GitHub Organizations
44

assets/tf-generate-variables.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
terraform_variable_names="name
4+
visibility
5+
description
6+
has_issues
7+
has_projects
8+
has_wiki
9+
is_template
10+
delete_branch_on_merge
11+
gitignore_template
12+
license_template
13+
archived
14+
archive_on_destroy
15+
pages
16+
topics
17+
template"
18+
19+
for v in $(echo ${terraform_variable_names})
20+
do
21+
echo "variable \"${v}\" {"
22+
echo " description = \"SOMETHING for the GitHub Organization. (Optional)\""
23+
echo " type = string"
24+
echo " default = \"\""
25+
echo "}"
26+
echo ""
27+
done
28+
29+
for v in $(echo ${terraform_variable_names})
30+
do
31+
echo "${v} = var.${v}"
32+
done
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# DevSecOps Dev Kit - Template terraform module example
1+
# DSODK - DevSecOps Dev Kit - Github Terraform Module Example
22

3-
This example creates 3 null resources.
3+
Default Terraform Module Example README
44

55
## Usage
66

@@ -34,7 +34,7 @@ No providers.
3434

3535
| Name | Source | Version |
3636
|------|--------|---------|
37-
| <a name="module_github_organizations"></a> [github\_organizations](#module\_github\_organizations) | ../.. | n/a |
37+
| <a name="module_github_organization"></a> [github\_organization](#module\_github\_organization) | ../../modules/github_organization | n/a |
3838

3939
## Resources
4040

@@ -45,7 +45,6 @@ No resources.
4545
| Name | Description | Type | Default | Required |
4646
|------|-------------|------|---------|:--------:|
4747
| <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_github_owner"></a> [github\_owner](#input\_github\_owner) | Target GitHub organization or individual user account to manage. (Required) | `string` | n/a | yes |
4948
| <a name="input_github_token"></a> [github\_token](#input\_github\_token) | GitHub API Auth using OAuth or Personal Access Token. (Required) | `string` | n/a | yes |
5049

5150
## Outputs
Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
provider "github" {
22

3-
token = var.github_token # GITHUB_TOKEN - GitHub API Auth using OAuth or Personal Access Token
4-
#base_url = var.github_base_url # GITHUB_BASE_URL - Target GitHub base API endpoint. Required for GitHub Enterprise
5-
owner = var.github_owner # GITHUB_OWNER - Target GitHub organization or individual user account to manage
3+
token = var.github_token # GITHUB_TOKEN - GitHub API Auth using OAuth or Personal Access Token
4+
owner = "dsodk-test-module-terraform-github" # GITHUB_OWNER - Target GitHub organization or individual user account to manage
5+
#base_url = var.github_base_url # GITHUB_BASE_URL - Target GitHub base API endpoint. Required for GitHub Enterprise
66

77
#write_delay_ms = try(var.github_write_delay_ms, 1000) # Milliseconds to sleep between write ops for GitHub API Rate Limit
88
#read_delay_ms = try(var.github_read_delay_ms, 0) # Milliseconds to sleep between read ops for GitHub API Rate Limit
99
}
1010

11-
locals {
12-
billing_email = var.billing_email
13-
}
1411
##################################################
1512
# GitHub Organization
1613
##################################################
1714

18-
module "github_organizations" {
19-
source = "../.."
15+
module "github_organization" {
16+
source = "../../modules/github_organization"
2017

21-
billing_email = local.billing_email
22-
company = "dsodk"
23-
email = "terraform.module[email protected]"
24-
name = "dsodk-test-github-org-module"
18+
billing_email = var.billing_email
19+
company = "dsodk.io"
20+
email = "module.terraform.github[email protected]"
21+
name = "dsodk-test-module-terraform-github"
2522
location = "Global"
26-
description = "Test organization used by example in dsodk-code-module-terraform-github-organization"
23+
description = "Test github resources used in examples of this terraform module project: dsodk-module-terraform-github"
2724

2825
default_repository_permission = "read"
2926

examples/github_organizations/variables.tf renamed to examples/github_organization/variables.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ variable "github_token" {
88
sensitive = true
99
}
1010

11-
variable "github_owner" {
12-
description = "Target GitHub organization or individual user account to manage. (Required)"
13-
type = string
14-
}
15-
1611
##################################################
1712
# GitHub Organization
1813
##################################################
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# DSODK - DevSecOps Dev Kit - Github Terraform Module Example
2+
3+
Default Terraform Module Example README
4+
5+
## Usage
6+
7+
To run this example you need to execute:
8+
9+
```bash
10+
$ terraform init
11+
$ terraform plan
12+
$ terraform apply
13+
```
14+
15+
After testing with this example is completed, run ```$ terraform destroy```
16+
17+
## Authors
18+
19+
* andreouellet
20+
21+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
22+
## Requirements
23+
24+
| Name | Version |
25+
|------|---------|
26+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
27+
| <a name="requirement_github"></a> [github](#requirement\_github) | 5.3.0 |
28+
29+
## Providers
30+
31+
No providers.
32+
33+
## Modules
34+
35+
| Name | Source | Version |
36+
|------|--------|---------|
37+
| <a name="module_github_repository"></a> [github\_repository](#module\_github\_repository) | ../../modules/github_repository | n/a |
38+
39+
## Resources
40+
41+
No resources.
42+
43+
## Inputs
44+
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_github_token"></a> [github\_token](#input\_github\_token) | GitHub API Auth using OAuth or Personal Access Token. (Required) | `string` | n/a | yes |
49+
50+
## Outputs
51+
52+
No outputs.
53+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
provider "github" {
2+
3+
token = var.github_token # GITHUB_TOKEN - GitHub API Auth using OAuth or Personal Access Token
4+
owner = "dsodk-test-module-terraform-github" # GITHUB_OWNER - Target GitHub organization or individual user account to manage
5+
#base_url = var.github_base_url # GITHUB_BASE_URL - Target GitHub base API endpoint. Required for GitHub Enterprise
6+
7+
#write_delay_ms = try(var.github_write_delay_ms, 1000) # Milliseconds to sleep between write ops for GitHub API Rate Limit
8+
#read_delay_ms = try(var.github_read_delay_ms, 0) # Milliseconds to sleep between read ops for GitHub API Rate Limit
9+
}
10+
11+
##################################################
12+
# GitHub Organization
13+
##################################################
14+
15+
module "github_repository" {
16+
source = "../../modules/github_repository"
17+
18+
name = "dsodk-test-module-terraform-github-repository-example"
19+
visibility = "private"
20+
description = "Repo created by example tests in dsodk-module-terraform-github"
21+
has_issues = true
22+
has_projects = true
23+
has_wiki = true
24+
is_template = false
25+
26+
delete_branch_on_merge = true
27+
gitignore_template = null
28+
license_template = "gpl-3.0"
29+
archived = false
30+
archive_on_destroy = false
31+
topics = ["test", "destroyable"]
32+
}

examples/github_repository/outputs.tf

Whitespace-only changes.

0 commit comments

Comments
 (0)