Skip to content

Terraform modules to manage Github repos

Notifications You must be signed in to change notification settings

a7d-corp/terraform-github-modules

Repository files navigation

terraform-github-modules

Terraform module to configure a Github repository.

Requirements

Name Version
github ~> 4.0

Providers

Name Version
github ~> 4.0

Resources

Name Type
github_repository.repo resource

Modules

github_repository

terraform-github-modules/github_repository/

Name Description Type Default Required
allow_auto_merge Allow auto-merging of pull requests. bool false no
allow_merge_commit Allow merge commits. bool true no
allow_rebase_merge Allow rebase merge commits. bool true no
allow_squash_merge Allow squash merge commits. bool true no
auto_init Create an initial commit in a new repository. bool true no
delete_branch_on_merge Delete branch on pull request merge. bool false no
from_template Was this repo generated from a template repo? bool false no
gitignore_template Template for the gitignore file. string null no
has_downloads Set to true to enable the (deprecated) downloads features on the repository. bool false no
has_issues Enable the GitHub issues feature for this repository. bool false no
has_projects Enable the GitHub projects feature for this repository. bool false no
has_wiki Enable the GitHub wiki feature for this repository. bool false no
is_template Set this repository as a template. bool false no
license_template Template for the license file. string null no
repo_description A description of the repository. string n/a yes
repo_name The name of the repository. string n/a yes
repo_visibility Repository visibility; either 'public' or 'private'. string n/a yes
template_repo_name The name of the template repository. string null no
template_repo_owner The GitHub organization or user the template repository is owned by. string null no
topics The list of topics of the repository. list(any) null no
vulnerability_alerts Enable security alerts for vulnerable dependencies. bool false no

github_repository_collaborator

terraform-github-modules/github_repository_collaborator/

Name Description Type Default Required
collaborator_name The user to add to the repository as a collaborator. string n/a yes
collaborator_permission The permission of the outside collaborator for the repository. string "push" no
repo_name The GitHub repository name. string n/a yes

github_repository_webhook

terraform-github-modules/github_repository_webhook/

Name Description Type Default Required
active Indicate if the webhook should receive events. bool true no
content_type The content type for the payload. string n/a yes
events A list of events which should trigger the webhook. list(string) n/a yes
insecure_ssl Insecure SSL boolean toggle. bool false no
repo_name The name of the repository. string n/a yes
secret The shared secret for the webhook. string n/a yes
url The URL of the webhook. string n/a yes

Outputs

No outputs.

Using the modules

Set the module source in your module configuration:

source = "github.com/glitchcrab/terraform-github-modules//github_repository"

Note: the // is important as it tells Terraform that it's a child directory of the main module repo.

Adding a new module

  • Create the directory and populate it with Terraform manifests.
  • Symlink _versions.tf from the root directory into the module directory.
  • Generate an inputs reference for the new module with the command below and add it to the README:
terraform-docs markdown table <module_dir> --escape=false