Skip to content

This is a Terraform module that creates a GitHub Repository based on your preference.

License

Notifications You must be signed in to change notification settings

mBlomsterberg/terraform-github-repository-module

Repository files navigation


terraform-github-repository-module

Terraform Module for GitHub Repository creation.

Module Examples · Versioning



About

Contact

Github mBlomsterberg

Linkedin Mikkel Blomsterberg

Setup

Versioning

We use Semantic Versioning for versioning.

Contribution guidelines

Should your repository be open to an external or onboarding new members you can create guidelines to communicate how people should contribute to your project. Example

Code of Conduct

This project has adopted the XXXXXX Code of Conduct. For more information see the Code of Conduct FAQ or contact mBlomsterberg with any additional questions or comments.

License

Licensed under the MIT license.

(back to top)

Requirements

Name Version
terraform >= 1.3.0
github >= 5.25.0, < 6.0.0

Providers

Name Version
github >= 5.25.0, < 6.0.0

Modules

No modules.

Resources

Name Type
github_actions_secret.personal_token resource
github_branch.this resource
github_branch_default.default resource
github_issue.example resource
github_repository.this resource
github_repository_autolink_reference.autolink resource
github_repository_collaborators.collaborators resource
github_repository_environment.this resource
github_repository_file.files resource
github_team.team_ids data source
github_user.current data source
github_user.user_ids data source

Inputs

Name Description Type Default Required
allow_auto_merge (Optional) Set to true to allow auto-merging pull requests on the repository. bool false no
allow_merge_commit (Optional) Set to false to disable merge commits on the repository. bool true no
allow_rebase_merge (Optional) Set to false to disable rebase merges on the repository. bool false no
allow_squash_merge (Optional) Set to false to disable squash merges on the repository. bool true no
allow_update_branch (Optional) Set to true to always suggest updating pull request branches. bool false no
archive_on_destroy (Optional) Set to true to archive the repository instead of deleting on destroy. bool true no
auto_init (Optional) Set to true to produce an initial commit in the repository. bool false no
branch_protection (Optional) The repository's default branch protection configuration.
object({
branch = optional(string, null)
enforce_admins = optional(bool, true)
required_status_checks = optional(object({
strict = optional(bool,false)
checks = optional(list(string), [])
}))
required_pull_request_reviews = optional(object({
dismiss_stale_reviews = optional(bool,true)
dismissal_users = optional(list(string),[])
dismissal_teams = optional(list(string),[])
require_code_owner_reviews = optional(bool,false)
required_approving_review_count = optional(number,0)
bypass_pull_request_allowances = optional(object({
users = optional(list(string),[""])
teams = optional(list(string),[""])
apps = optional(list(string),[])
}), null)
}), {})
})
null no
codeowners (Optional) This is the target team or individual user account that manages the code in the repository. list(string) null no
collaborator_teams (Optional) The list of team names that is added as collaborators to the repository.
list(object({
permission = optional(string, "read")
team_id = optional(string, "")
}))
[] no
collaborator_users (Optional) The list of user names that is added as collaborators to the repository.
list(object({
permission = optional(string, "read")
username = optional(string, "")
}))
[] no
default_branch (Optional) Set to true to produce an initial commit in the repository. string null no
delete_branch_on_merge (Optional) Automatically delete head branch after a pull request is merged. Defaults to false. bool false no
description (Optional) A description of the repository. string "Terraform created GitHub Repository" no
environments (Optional) The repository's environment configurations.
list(object({
environment = string
wait_timer = optional(number,0)
reviewers = optional(object({
users = optional(list(string),[])
teams = optional(list(string),[])
}), null)
deployment_branch_policy = optional(object({
protected_branches = optional(bool, false)
custom_branch_policies = optional(bool,false)
}),null)

}))
[] no
github_repository_autolink_reference (Optional) This allows you to create an autolink reference.
object({
key_prefix = string
target_url_template = string
is_alphanumeric = optional(bool, false)
})
null no
gitignore_template (Optional) Use the name of the template without the extension. For example, "Haskell". string null no
has_discussions (Optional) Set to true to enable GitHub Discussions on the repository. bool false no
has_issues (Optional) Set to true to enable the GitHub Issues features on the repository. bool false no
has_projects (Optional) Set to true to enable the GitHub Projects features on the repository. bool false no
has_wiki (Optional) Set to true to enable the GitHub Wiki features on the repository. bool false no
homepage_url (Optional) URL of a page describing the project. string "" no
ignore_vulnerability_alerts_during_read (Optional) Set to true to not call the vulnerability alerts endpoint so the resource can also be used without admin permissions during read. bool false no
is_template (Optional) Set to true to tell GitHub that this is a template repository. bool false no
license_template (Optional) Use the name of the template without the extension. Default is "mit". string "mit" no
merge_commit_message (Optional) Can be PR_BODY, PR_TITLE, or BLANK for a default merge commit message. string "BLANK" no
merge_commit_title (Optional) Can be PR_TITLE or MERGE_MESSAGE for a default merge commit title. string "PR_TITLE" no
name (Required) The name of the repository. string n/a yes
owner (Optional) This is the target GitHub organization or individual user account to manage. string null no
pages (Optional) The repository's GitHub Pages configuration.
object({
branch = string
path = optional(string, "/")
cname = optional(string, "")
})
null no
repository_branches (Optional) The list of branche names to create in the repository. list(string) [] no
security_and_analysis (Optional) The repository's security and analysis configuration.
object({
advanced_security = optional(string, "disabled")
secret_scanning = optional(string, "disabled")
secret_scanning_push_protection = optional(string, "disabled")
})
null no
squash_merge_commit_message (Optional) Can be PR_BODY, COMMIT_MESSAGES, or BLANK for a default squash merge commit message. string "BLANK" no
squash_merge_commit_title (Optional) Can be PR_TITLE or COMMIT_OR_PR_TITLE for a default squash merge commit title. string "PR_TITLE" no
template (Optional) Use a template repository to create this resource.
object({
owner = string
repository = string
include_all_branches = optional(bool, false)
})
null no
token (Optional) A GitHub OAuth / Personal Access Token. string null no
topics (Optional) The list of topics of the repository. list(string) [] no
visibility (Optional) Can be public or private or internal. string "public" no
vulnerability_alerts (Optional) Set to true to enable security alerts for vulnerable dependencies. bool false no

Outputs

No outputs.

About

This is a Terraform module that creates a GitHub Repository based on your preference.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages