This Terraform module manages GitHub repositories.
module "my_pets_website_repo" {
source = "github.com/flaconi/terraform-github-repository.git?ref=master"
name = "my-pets-website"
description = "My pets codebase."
visibility = "private"
gitignore_template = "Node"
default_branch_protection_enabled = false
}
module "terraform_my_pets_repo" {
source = "github.com/flaconi/terraform-github-repository.git?ref=master"
namespace = "terraform"
tenant = "my"
name = "pets"
description = "Terraform configuration for my pets."
visibility = "public"
gitignore_template = "Terraform"
license_template = "mit"
}
data "github_team" "developers" {
slug = "developers"
}
module "example_repo" {
source = "github.com/flaconi/terraform-github-repository.git?ref=master"
name = "example"
description = "My example codebase"
visibility = "private"
teams = [
{
name = "security"
permisson = "admin"
},
{
# Specify Team ID to use external data source
id = data.github_team.developers.id
name = "developers"
permission = "push"
}
]
}
module "example_repo" {
source = "github.com/flaconi/terraform-github-repository.git?ref=master"
name = "example"
description = "My example codebase"
visibility = "private"
# Overwrite some settings for default branch
default_branch_protection = {
required_status_checks = {
contexts = ["ci/travis"]
}
required_pull_request_reviews = {
dismiss_stale_reviews = true
dismissal_restrictions = ["team1","team2"]
}
}
}
module "example_repo" {
source = "github.com/flaconi/terraform-github-repository.git?ref=master"
name = "example"
description = "My example codebase"
visibility = "private"
default_branch_protection_enabled = false
issue_labels = [
{
name = "bug"
color = "d73a4a"
description = "This is a bug."
},
{
name = "wontfix"
color = "ffffff"
description = null
},
]
}
Name | Version |
---|---|
terraform | >= 1.3 |
github | ~> 6.2 |
Name | Version |
---|---|
github | ~> 6.2 |
Name | Source | Version |
---|---|---|
label | github.com/cloudposse/terraform-null-label.git | 0.25.0 |
Name | Type |
---|---|
github_actions_environment_secret.this | resource |
github_actions_repository_access_level.this | resource |
github_actions_secret.this | resource |
github_branch_default.this | resource |
github_branch_protection.this | resource |
github_dependabot_secret.this | resource |
github_issue_label.this | resource |
github_repository.this | resource |
github_repository_collaborator.this | resource |
github_repository_deploy_key.this | resource |
github_repository_environment.this | resource |
github_repository_ruleset.this | resource |
github_repository_webhook.this | resource |
github_team_repository.this | resource |
github_team.this | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
name | The name of the repository. | string |
n/a | yes |
actions_repository_access_level | This resource allows you to set the access level of a non-public repositories actions and reusable workflows for use in other repositories. | string |
null |
no |
allow_auto_merge | Set to true to allow auto-merging pull requests on the repository. |
bool |
false |
no |
allow_merge_commit | Set to false to disable merge commits on the repository. |
bool |
false |
no |
allow_rebase_merge | Set to false to disable rebase merges on the repository. |
bool |
false |
no |
allow_squash_merge | Set to false to disable squash merges on the repository. |
bool |
true |
no |
allow_update_branch | Set to true to always suggest updating pull request branches. |
bool |
false |
no |
archive_on_destroy | Set to true to archive the repository instead of deleting on destroy. |
bool |
false |
no |
archived | Specifies if the repository should be archived. | bool |
false |
no |
attributes | Additional attributes (e.g. policy or role ) |
list(string) |
[] |
no |
auto_init | Meaningful only during create; set to true to produce an initial commit in the repository. |
bool |
true |
no |
bot_secrets | Repository dependabot secrets. | map(object({ |
{} |
no |
branch_protection | Branch protection settings. Use to set protection rules for branches different to default branch. | map(object({ |
{} |
no |
collaborators | Map of users with permissions. | map(string) |
{} |
no |
default_branch | The repository's default branch. The branch should exist prio to apply. | string |
"main" |
no |
default_branch_protection | Default branch protection settings. | object({ |
{} |
no |
default_branch_protection_enabled | Set to false if you want to disable branch protection for default branch |
bool |
true |
no |
delete_branch_on_merge | Automatically delete head branch after a pull request is merged. | bool |
true |
no |
delimiter | Delimiter to be used between name , namespace , tenant , etc. |
string |
"-" |
no |
deploy_keys | List of deploy keys configurations. | list(object({ |
[] |
no |
description | A description of the repository. | string |
"" |
no |
environments | Repository environments. | map(object({ |
{} |
no |
gitignore_template | Meaningful only during create, will be ignored after repository creation. Use the name of the template without the extension. For example, "Terraform". | string |
"" |
no |
has_downloads | Set to true to enable the (deprecated) downloads features on the repository. |
bool |
null |
no |
has_issues | Set to false to disable the GitHub Issues features on the repository. |
bool |
true |
no |
has_projects | Set to true to enable the GitHub Projects features on the repository. |
bool |
false |
no |
has_wiki | Set to true to enable the GitHub Wiki features on the repository. |
bool |
false |
no |
homepage_url | URL of a page describing the project. | string |
"" |
no |
is_template | Set to true to tell GitHub that this is a template repository. |
bool |
false |
no |
issue_labels | List of issue labels on the repository. | list(object({ |
[] |
no |
license_template | Meaningful only during create, will be ignored after repository creation. Use the name of the template without the extension. For example, "Terraform". | string |
"" |
no |
merge_commit_message | Can be PR_BODY , PR_TITLE , or BLANK for a default merge commit message. |
string |
"PR_TITLE" |
no |
merge_commit_title | Can be PR_TITLE or MERGE_MESSAGE for a default merge commit title. |
string |
"MERGE_MESSAGE" |
no |
namespace | Namespace, e.g. terraform , product , mobile etc. |
string |
null |
no |
pages | The repository's GitHub Pages configuration. | object({ |
null |
no |
rulesets | n/a | map(object({ |
{} |
no |
secrets | Repository secrets. | map(object({ |
{} |
no |
squash_merge_commit_message | Can be PR_BODY , COMMIT_MESSAGES , or BLANK for a default squash merge commit message. |
string |
"COMMIT_MESSAGES" |
no |
squash_merge_commit_title | Can be PR_TITLE or COMMIT_OR_PR_TITLE for a default squash merge commit title. |
string |
"COMMIT_OR_PR_TITLE" |
no |
tags | Additional tags (e.g. map('BusinessUnit','XYZ') ) |
map(string) |
{} |
no |
teams | List of teams with permissions. Specify Team ID to avoid additional requests to GitHub API. | list(object({ |
[] |
no |
template | Use a template repository to create this repository. | object({ |
null |
no |
tenant | A customer identifier, indicating who this instance of a resource is for. Could be used for application grouping. | string |
null |
no |
topics | A list of topics to add to the repository. | list(string) |
[] |
no |
use_fullname | Set 'true' to use namespace-tenant-name for github repository name, else name |
bool |
true |
no |
visibility | Set to public to create a public (e.g. open source) repository. |
string |
"private" |
no |
vulnerability_alerts | Set to true to enable security alerts for vulnerable dependencies. Enabling requires alerts to be enabled on the owner level. |
bool |
false |
no |
webhooks | List of webhook configurations. | list(object({ |
[] |
no |
Name | Description |
---|---|
dependabot_secrets | A map of dependabot secret names |
environments | A list of created environments |
environments_secrets | A map of environment secret names |
repository | Created repository |
repository_branch_protection | Default branch protection settings |
repository_secrets | A map of create secret names |
repository_webhook_urls | Webhook URLs |
Copyright (c) 2019-2022 Flaconi GmbH