Terraform module for creating GitHub repositories
This module outputs attributes from the github_repository
resource and data source. Because this module allows you to auto_init
a repository and set a different branch_default
than main
, the resource is out of date from reality. For this reason, when the data source can provide the most up to date information on a repository attribute it will be used, and in cases where the data source doesn't provide the attribute value, the resource will be used.
Name | Version |
---|---|
terraform | ~> 1.3 |
github | >= 5.0 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
name | The name of the repository | string |
n/a | yes |
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 |
true |
no |
allow_rebase_merge | Set to false to disable rebase merges on the repository | bool |
true |
no |
allow_squash_merge | Set to false to disable squash merges on the repository | bool |
true |
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. Defaults to false | bool |
false |
no |
auto_init | Set to true to produce an initial commit in the repository | bool |
false |
no |
branch_default | The default branch. Defaults to main |
string |
"main" |
no |
branches | Branches to configure for the repository | list(string) |
[ "main" ] |
no |
delete_branch_on_merge | Automatically delete head branch after a pull request is merged. Defaults to false | bool |
false |
no |
description | A description of the repository | string |
null |
no |
gitignore_template | Use the name of the template without the extension. For example, 'Haskell' | string |
null |
no |
has_downloads | Set to true to enable the (deprecated) downloads features on the repository | bool |
false |
no |
has_issues | Set to true to enable the GitHub Issues features on the repository | bool |
false |
no |
has_projects | Set to true to enable the GitHub Projects features on the repository. Per the GitHub documentation when in an organization that has disabled repository projects it will default to false and will otherwise default to true. If you specify true when it has been disabled it will return an error | 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 description the project | string |
null |
no |
ignore_vulnerability_alerts_during_read | 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 | Set to true to tell GitHub that this is a template repository | bool |
false |
no |
license_template | Use the name of the template without the extension. For example, 'mit' or 'mpl-2.0' | string |
null |
no |
pages | The repository's GitHub Pages configuration. See GitHub Pages Configuration for details. | object( { branch = string # The repository branch used to publish the site's source files path = optional(string, "/") # The repository directory from which the site publishes } ) |
null |
no |
repository_default_branch | GitHub and GitHub Enterprise organizations auto-initialize repositories with a default branch name. Default: main |
string |
"main" |
no |
template | Use a template repository to create this resource. See Template Repositories for details. | object( { owner = string # The GitHub organization or user the template repository is owned by repository = string # The name of the template repository } ) |
null |
no |
topics | The list of topics of the repository | list(string) |
null |
no |
visibility | Can be public or private. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, visibility can also be internal. | string |
"public" |
no |
vulnerability_alerts | Set to true to enable security alerts for vulnerable dependencies. See GitHub Documentation for details | bool |
false |
no |
Name | Description |
---|---|
allow_auto_merge | Repository auto merge value |
allow_merge_commit | Repository merge commit value |
allow_rebase_merge | Repository rebase merge value |
allow_squash_merge | Repository squash merge value |
archive_on_destroy | Archive repository on destruction |
archived | Repository is archied |
auto_init | Auto initialize repository |
branches | Repository branches |
default_branch | Repository default branch |
delete_branch_on_merge | Repository delete branch on merge value |
description | Repository description |
full_name | Repository full name |
git_clone_url | Repository git clone URL |
gitignore_template | Repository gitignore template |
has_downloads | Repository download feature value |
has_issues | Repository issues feature value |
has_projects | Repository projects feature value |
has_wiki | Repository wiki feature value |
homepage_url | Repository homepage URL |
html_url | Repository HTML URL |
http_clone_url | Repository HTTP clone URL |
id | Repository ID |
ignore_vulnerability_alerts_during_read | Repository ignore vulnerability alerts during read value |
is_template | Repository template value |
license_template | Repository license template value |
name | Repository name |
node_id | Repository node ID |
pages | Repository pages value |
repo_id | Repository ID |
repository | Full repository object from resource and data source |
ssh_clone_url | Repository SSH clone URL |
svn_url | Repository SVN URL |
template | Repository template value |
topics | Repository topics |
visibility | Repository visibility (replaces private ) |
vulnerability_alerts | Repository vulnerability alerts |
Contributions are always welcome. Please consult our CONTRIBUTING.md file for more information on how to submit quality contributions.
Author: Brian Menges (@mengesb)
Copyright 2022 Brian Menges
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.