Skip to content

Latest commit

 

History

History

repository

repository

This module creates following resources.

  • github_repository
  • github_repository_collaborator (optional)
  • github_repository_collaborators (optional)
  • github_team_repository (optional)
  • github_repository_autolink_reference (optional)
  • github_repository_deploy_key (optional)
  • github_repository_topics (optional)
  • github_issue_label (optional)
  • github_branch_default (optional)

Requirements

Name Version
terraform >= 1.9
github >= 6.2

Providers

Name Version
github 6.2.2

Modules

No modules.

Resources

Name Type
github_branch.this resource
github_branch_default.this resource
github_issue_label.this resource
github_repository.this resource
github_repository_autolink_reference.this resource
github_repository_collaborator.this resource
github_repository_collaborators.this resource
github_repository_deploy_key.this resource
github_repository_topics.this resource
github_team_repository.this resource

Inputs

Name Description Type Default Required
name (Required) A name of the repository. string n/a yes
access (Optional) A configuration for the repository access. access block as defined below.
(Optional) collaborators - A list of collaborators to the repository. Each item of collaborators block as defined below.
(Required) username - The GitHub username to add to the repository as a collaborator.
(Optional) role - The role to grant the collaborator in the repository. Valid values are read, triage, write, maintain, admin or the name of an existing custom repository role within the organisation. Default is write.
(Optional) teams - A list of teams to the repository. Each item of teams block as defined below.
(Required) team - The GitHub team id or the GitHub team slug.
(Optional) role - The role to grant the team in the repository. Valid values are read, triage, write, maintain, admin or the name of an existing custom repository role within the organisation. Default is read.
(Optional) sync_enabled - Whether to sync the repository access. Accesses added outside of the Terraform code will be removed. Defaults to false.
object({
collaborators = optional(list(object({
username = string
role = optional(string, "write")
})), [])
teams = optional(list(object({
team = string
role = optional(string, "read")
})), [])
sync_enabled = optional(bool, false)
})
{} no
archive_on_destroy (Optional) Whether to archive the repository instead of deleting on destroy. Defaults to false. bool false no
archived (Optional) Specify if the repository should be archived. Defaults to false. NOTE: Currently, the API does not support unarchiving. bool false no
auto_merge_enabled (Optional) Whether to wait for merge requirements to be met and then merge automatically. Defaults to false. bool false no
autolink_references (Optional) A list of autolink references for the repository. Each item of autolink_references block as defined below.
(Required) key_prefix - This prefix appended by a string will generate a link any time it is found in an issue, pull request, or commit.
(Required) target_url_template - The URL must contain for the reference number.
(Optional) is_alphanumeric - Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Defaults to false.
set(object({
key_prefix = string
target_url_template = string
is_alphanumeric = optional(bool, false)
}))
[] no
branches (Optional) A list of branches to create and manage within the repository. set(string) [] no
default_branch (Optional) Set the default branch for the repository. Default is main branch. string "main" no
delete_branch_on_merge (Optional) Automatically delete head branch after a pull request is merged. Defaults to true. bool true no
deploy_keys (Optional) A list of deploy keys to grant access to the repository. A deploy key is a SSH key. Each item of deploy_keys block as defined below.
(Optional) name - A name of deploy key.
(Required) key - A SSH key. Begins with 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519', 'sk-ecdsa-sha2-nistp256@openssh.com', or 'sk-ssh-ed25519@openssh.com'.
(Optional) writable - Whether to allow write access to the repository. The key can be used to push to the repository if enabled. Defaults to false.
list(object({
name = optional(string)
key = string
writable = optional(bool, false)
}))
[] no
description (Optional) A description of the repository. string "Managed by Terraform." no
features (Optional) A list of enabled features on the repository. Available features: ISSUES, PROJECTS, WIKI. Defaults to ["ISSUES"] set(string)
[
"ISSUES"
]
no
homepage (Optional) A URL of website describing the repository. string "" no
is_template (Optional) Whether this is a template repository. Defaults to false. bool false no
issue_labels (Optional) A list of issue labels for the repository. Each member of issue_labels block as defined below.
(Required) name - The name of the label.
(Required) color - A 6 character hex code, without the leading #, identifying the color of the label.
(Optional) description - A short description of the label.
set(object({
name = string
color = string
description = optional(string, "Managed by Terraform.")
}))
[] no
merge_strategies (Optional) A list of allowed strategies for merging pull requests on the repository. Available strategies: MERGE_COMMIT, SQUASH, REBASE. Defaults to ["SQUASH", "REBASE"]. set(string)
[
"SQUASH",
"REBASE"
]
no
pages (Optional) A configuration of GitHub Pages for the repository. pages block as defined below.
(Optional) enabled - Whether to enable GitHub Pages for the repository. GitHub Pages is designed to host your personal, organization, or project pages from a GitHub repository. Defaults to false.
(Optional) source - A configuration of the repository source files for the site. source block as defined below.
(Optional) branch - The repository branch used to publish the site's source files. Defaults to gh-pages branch.
(Optional) path - The repository directory path from which the site publishes. Defaults to /.
(Optional) cname - The custom domain for the repository. This can only be set after the repository has been created.
object({
enabled = optional(bool, false)
source = optional(object({
branch = optional(string, "gh-pages")
path = optional(string, "/")
}), {})
cname = optional(string)
})
{} no
template (Optional) Use a template repository, license or gitignore to create the repository.this resource. template block as defined below.
(Optional) gitignore - Choose which files not to track from a list of templates. Use the name of the template without the extension. For example, Haskell.
(Optional) init_readme - Whether to produce an initial commit with README.md in the repository. Defaults to false.
(Optional) license - A license tells others what they can and can't do with your code. Use the name of the license template without the extension. For example, mit or mpl-2.0.
(Optional) repository - Start this repository with a template repository's contents. The full name of the repository is required. A string of the form owner/repository.
object({
gitignore = optional(string)
init_readme = optional(bool, false)
license = optional(string)
repository = optional(string)
})
{} no
topics (Optional) A list of topics for the repository. set(string) [] no
visibility (Optional) Can be public, private or internal. internal visibility is only available if your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. string "private" no
vulnerability_alerts (Optional) Set to true to enable security alerts for vulnerable dependencies. Enabling requires alerts to be enabled on the owner level. GitHub enables the alerts on public repos but disables them on private repos by default. bool false no

Outputs

Name Description
access The configuration for the repository access.
archived Whether the repository is archived.
auto_merge_enabled Whether to wait for merge requirements to be met and then merge automatically.
autolink_references A list of autolink references for the repository.
branches A list of the repository branches excluding initial branch.
default_branch The default branch of the repository.
delete_branch_on_merge Automatically delete head branch after a pull request is merged.
deploy_keys A map of deploy keys granted access to the repository.
description The description of the repository.
features A list of available features on the repository.
full_name The full name of the repository. A string of the form orgname/reponame
git_clone_url The URL that can be provided to git clone to clone the repository anonymously via the git protocol.
homepage A URL of the website for the repository.
http_clone_url The URL that can be provided to git clone to clone the repository anonymously via HTTPS.
id The ID of the GitHub repository.
is_template Whether this is a template repository.
issue_labels A list of issue labels for the repository.
merge_strategies A list of available strategies for merging pull requests on the repository.
name The name of the repository.
node_id The node ID of the GitHub repository. This is GraphQL global node id for use with v4 API.
pages The repository's GitHub Pages configuration.
ssh_clone_url The URL that can be provided to git clone to clone the repository anonymously via SSH.
template The template of the repository.
topics A list of topics for the repository.
url The URL of the repository.
visibility The visibility of the repository. Can be public, private or internal.
vulnerability_alerts Whether the security alerts are enabled for vulnerable dpendencies.