Skip to content

plus3it/terraform-github-repo

Repository files navigation

terraform-github-repo

A terraform module to create an organization repository and configure team access as well as branch protections. Note: this will only create an organizational repository

Testing

At the moment, testing is manual:

# Replace "xxx" with an your github access token, then execute the integration tests.
export GITHUB_TOKEN=xxx 
make terraform/pytest PYTEST_ARGS="-v --nomock"

Requirements

Name Version
terraform >= 0.14
github >= 4.0

Providers

Name Version
github >= 4.0

Resources

Name Type
github_team.teams data source

Inputs

Name Description Type Default Required
name Name of the repository string n/a yes
allow_merge_commit Whether to allow merge commits bool false no
allow_rebase_merge Whether to allow rebase merging bool true no
allow_squash_merge Whether to allow squash merging bool false no
archive_on_destroy Whether to archive on destroy instead of delete bool false no
auto_init Automatically initialize the repository upon creation bool true no
branch_protection Branch protection configuration
object({
enforce_admins = optional(bool)
push_restrictions = optional(list(string))
require_signed_commits = optional(bool)
required_status_checks = optional(object({
strict = optional(bool)
contexts = list(string)
}))
required_pull_request_reviews = optional(object({
dismiss_stale_reviews = optional(bool)
dismissal_restrictions = optional(list(string))
require_code_owner_reviews = optional(bool)
required_approving_review_count = number
}))
})
null no
delete_branch_on_merge Automatically delete head branch after a pull request is merged bool true no
description Description of the repository string null no
gitignore_template Gitignore template to include in the repository string null no
has_issues Enable the GitHub Issues features on the repository bool true no
has_projects Enable the GitHub Projects features on the repository bool false no
has_wiki Enable the GitHub Wiki features on the repository bool false no
homepage_url URL of a page describing the project string null no
is_template Configure this repository as a template repository bool false no
license_template Type of license to include in the repository string null no
teams List of teams to grant permissions to the repository
list(object({
name = string
permission = optional(string)
}))
[] no
template Template repository used to create this repository
object({
owner = string
repository = string
})
null no
topics List of topics to apply to the repository list(string) [] no
visibility Visibility of the repository. One of: public, private, or internal string "public" no
vulnerability_alerts Whether to enable security alerts for dependencies bool true no

Outputs

Name Description
repo Object with all repo attributes