Terraform module for managing Github repositories.
.
├── .github # Github configuration directory
│ └── workflows # Github Actions configuration
│ └── ci.yml # CI pipeline configuration
├── .gitignore # git ignore file
├── .terraform-docs.yml # terraform-docs configuration
├── .terraform.lock.hcl # terraform lock file
├── Makefile # makefile for ease
├── README.md # this file
├── examples # terraform module examples of use
│ └── docs # terraform module examples of use for documentation
│ └── main.tf # terraform main.tf file for documentation
├── main.tf # terraform module main.tf file
├── outputs.tf # terraform module outputs.tf file
└── variables.tf # terraform module variables.tf file
| Name | Version |
|---|---|
| github | 5.34.0 |
| Name | Type |
|---|---|
| github_actions_secret.this | resource |
| github_branch_protection.this | resource |
| github_repository.this | resource |
| github_repository_webhook.this | resource |
| github_team_repository.this | resource |
No modules.
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| account | Account (individual user or organization) where the repositories will be created. | string |
n/a | yes |
| account_type | Type of Github account. | string |
"user" |
no |
| default_repository_config | The default configuration to be applied to all repositories. | any |
{ |
no |
| repositories | List of objects containing the repository definitions. Parameter 'name' is mandatory. | any |
n/a | yes |
| Name | Description |
|---|---|
| http_clone_urls | HTTP urls for cloning the repositories. |
| repository_names | Names of the repositories. |
| ssh_clone_urls | SSH urls for cloning the repositories. |
| Name | Version |
|---|---|
| terraform | ~> 1.0 |
| github | ~> 5.34 |
- This project uses Semantic Versioning.
module "github_repo" {
source = "../../"
account = "myOrg"
default_repository_config = {
allow_merge_commit = false
allow_rebase_merge = false
allow_squash_merge = true
auto_init = false
delete_branch_on_merge = true
has_downloads = false
has_issues = false
has_projects = false
has_wiki = false
visibility = "private"
vulnerability_alerts = true
branch_protection_rules = [
{
branch_name_pattern = "main"
}
]
webhooks = [
{
active = true
events = ["push", "pull_request"]
url = "https://ci-1.contoso.com"
}
]
}
repositories = [
{
name = "foo"
description = "Repo for the foo project."
vulnerability_alerts = false
access = {
"team1" = "admin"
"user1" = "pull"
},
branch_protection_rules = [
{
branch_name_pattern = "master"
allow_force_pushes = true
}
]
actions_repository_secrets = [
{
secret_name = "TOKEN"
encrypted_value = var.secret_token_value
}
]
}, {
name = "bar"
description = "Repo for the bar project."
access = {
"team1" = "pull"
"user1" = "admin"
}
branch_protection_rules = [
{
branch_name_pattern = "main"
required_pull_request_reviews = {
required_approving_review_count = 2
}
}
]
webhooks = [
{
active = true
events = ["pull_request"]
insecure_ssl = true
url = "https://ci-2.contoso.com"
},
{
active = false
events = ["issues"]
insecure_ssl = true
url = "https://ci-3.contoso.com"
}
]
}
]
}