Terraform module to provision an github repository.
This is a list of plugins that need to be installed previously to enjoy all the goodies of this configuration:
module "main_with_pages" {
source = "hadenlabs/repository/github"
version = "1.0.0"
providers = {
github = github
}
name = "repository-example-with-key"
description = "github repository for repository"
visibility = "public"
pages = {
branch = "gh-pages"
path = "/"
}
topics = [
"go",
"terraform",
]
settings = {
has_wiki = true
has_projects = true
}
Full working examples can be found in examples folder.
module "main" {
source = "hadenlabs/repository/github"
version = "1.0.0"
providers = {
github = github
}
name = "repository-example"
description = "github repository for repository"
visibility = "public"
settings = {
auto_init = true
has_issues = true
has_wiki = true
has_projects = true
}
}
module "main_with_key" {
source = "hadenlabs/repository/github"
version = "1.0.0"
providers = {
github = github
}
name = "repository-example-with-key"
description = "github repository for repository"
visibility = "public"
deploy_keys = [{
title = "user key"
key = "/usr/etc/key/user.pub"
read_only = false
}]
}
module "main_with_secrets" {
source = "hadenlabs/repository/github"
version = "1.0.0"
providers = {
github = github
}
name = "repository-example-with-key"
description = "github repository for repository"
visibility = "public"
secrets = {
key= value
}
}
module "main_with_pages" {
source = "hadenlabs/repository/github"
version = "1.0.0"
providers = {
github = github
}
name = "repository-example-with-key"
description = "github repository for repository"
visibility = "public"
pages = {
branch = "gh-pages"
path = "/"
}
topics = [
"go",
"terraform",
]
settings = {
has_wiki = true
has_projects = true
}
}
module "main" {
source = "hadenlabs/repository/github"
version = "1.0.0"
providers = {
github = github
}
name = "repository-example"
description = "github repository for repository"
visibility = "public"
settings = {
auto_init = true
has_issues = true
has_wiki = true
has_projects = true
}
pages = {
owner = "owner-user"
repository = "name-repository"
}
}
module "main" {
source = "hadenlabs/repository/github"
version = "1.0.0"
providers = {
github = github
}
name = "repository-example"
description = "github repository for repository"
visibility = "public"
settings = {
auto_init = true
has_issues = true
has_wiki = true
has_projects = true
}
collaborators = [
{
username = "other-user"
permission = "push"
},
]
}
module "repository_file" {
providers = {
github = github
}
source = "hadenlabs/repository/github"
version = "1.0.0"
name = "repository-example"
description = "repository example"
visibility = "public"
settings = {
auto_init = true
}
files = [
{
branch = "main"
file = "LICENSE"
content = file(format("%s/LICENSE", path.module))
commit_message = "ci: implement template"
commit_author = "@slovacus"
commit_email = "slovacus@gmail.com"
overwrite_on_create = true
},
]
}
module "repository_file" {
providers = {
github = github
}
source = "hadenlabs/repository/github"
version = "1.0.0"
name = "repository-example"
is_git_flow = true
description = "repository example"
visibility = "public"
settings = {
auto_init = true
}
}
module "repository_file" {
providers = {
github = github
}
source = "hadenlabs/repository/github"
version = "1.0.0"
name = "repository-example"
description = "repository example"
visibility = "public"
types = ["django"]
topics = ["go"]
}
module "repository_file" {
providers = {
github = github
}
source = "hadenlabs/repository/github"
version = "1.0.0"
name = "repository-example"
description = "repository example"
visibility = "public"
add_labels_default = false
}
module "repository_file" {
providers = {
github = github
}
source = "hadenlabs/repository/github"
version = "1.0.0"
name = "repository-example"
description = "repository example"
visibility = "public"
settings = {
template = {
owner = "hadenlabs"
repository = "terraform-github-repository"
}
}
}
module "repository_branch_protection" {
providers = {
github = github
}
source = "hadenlabs/repository/github"
version = "1.0.0"
name = "repository-example"
description = "repository example"
visibility = "public"
branch_protection = {
"develop" = {
enforce_admins = true
allows_deletions = false
}
}
}
| Name | Version |
|---|---|
| terraform | >= 0.12.20, < 2.0 |
| github | >=4.5.0 |
| local | >=1.3.0 |
| Name | Version |
|---|---|
| github | >=4.5.0 |
No modules.
| Name | Type |
|---|---|
| github_actions_secret.this | resource |
| github_branch.develop | resource |
| github_branch.gh_pages | resource |
| github_branch_default.develop_default | resource |
| github_branch_protection.this | resource |
| github_issue_label.this | resource |
| github_repository.this | resource |
| github_repository_collaborator.this | resource |
| github_repository_deploy_key.this | resource |
| github_repository_file.this | resource |
| github_repository_project.this | resource |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| add_labels_default | add labels default | bool |
true |
no |
| branch_protection | branch protections | map(any) |
{} |
no |
| collaborators | List of Collaborator Objects | list(object({ |
[] |
no |
| default_branch | Name of the Default Branch of the Repository | string |
"develop" |
no |
| deploy_keys | The name of repositories. | list(object({ |
[] |
no |
| description | The description of the repository. | string |
n/a | yes |
| files | list files for repository | list(object({ |
[] |
no |
| is_git_flow | Git Flow - Github Flow | bool |
false |
no |
| name | The name of the repository. | string |
n/a | yes |
| pages | Configuration block for GitHub Pages | map(any) |
{} |
no |
| secrets | secrets for repository | map(any) |
{} |
no |
| settings | Create and manage settings. | any |
{} |
no |
| topics | topics of project. | list(string) |
[] |
no |
| types | types of project. | list(string) |
[] |
no |
| visibility | The visibility of the repository private or public. | string |
"private" |
no |
| Name | Description |
|---|---|
| deploy_key | output instance deploy_key |
| files | output instance github files |
| instance | output instance repository |
| labels | output topics github repository |
| name | output name repository |
| secrets | output instance github actions secrets |
| topics | output topics github repository |
File a GitHub issue.
See Contributing.
This Module follows the principles of Semantic Versioning (SemVer).
Using the given version number of MAJOR.MINOR.PATCH, we apply the following constructs:
- Use the
MAJORversion for incompatible changes. - Use the
MINORversion when adding functionality in a backwards compatible manner. - Use the
PATCHversion when introducing backwards compatible bug fixes.
- In the context of initial development, backwards compatibility in versions
0.0.zis not guaranteed whenzis increased. (Initial development) - In the context of pre-release, backwards compatibility in versions
0.y.zis not guaranteed whenyis increased. (Pre-release)
Copyright Β© 2018-2026 Hadenlabs
All other trademarks referenced herein are the property of their respective owners.
The code and styles are licensed under the LGPL-3.0 license See project license..