Skip to content

Latest commit

 

History

History
109 lines (89 loc) · 8 KB

File metadata and controls

109 lines (89 loc) · 8 KB

GitHub repository

Create an opiniated github repository with terraform

Authentication

  • you must create a github app or a classic token with adminn rights
  • then add the following in your provider configuration :

reference: https://registry.terraform.io/providers/integrations/github/latest/docs

using an app (recommended)

provider "github" {
  owner = var.github_organization
  # set one of GITHUB_APP_ID, GITHUB_APP_INSTALLATION_ID, GITHUB_APP_PEM_FILE env var
  app_auth {}
}

using a github token (classic)

provider "github" {
  owner = var.github_organization
  # and set GITHUB_TOKEN env var in your shell
}

Requirements

Name Version
terraform ~> 1.3
github ~> 6.0
time ~> 0.9.1

Providers

Name Version
github ~> 6.0
time ~> 0.9.1

Modules

No modules.

Resources

Name Type
github_branch_default.main resource
github_repository.repository resource
github_team_repository.admins resource
time_static.last_update resource

Inputs

Name Description Type Default Required
admin_team The org team to set as admins string n/a yes
allow_auto_merge Set to true to allow auto-merge bool false no
allow_merge_commit Set to true to allow merge commits bool false no
allow_rebase_merge Set to true to allow rebase merges bool true no
allow_squash_merge Set to true to allow squash merges bool false no
allow_update_branch Set to true to allow updating branches bool false no
archive_on_destroy Set to true to archive the repository instead of deleting on destroy bool false no
archived Set to true to archive the repository bool false no
auto_init Set to true to produce an initial commit in the repository bool true no
customer Customer for the current deployment string "" no
delete_branch_on_merge Set to true to delete head branches when pull requests are merged bool true no
description A short description of the repository string "terraform created repository" no
gitignore_template Use a template for the .gitignore file string "" no
has_discussions Set to true to enable discussions for this repository bool false no
has_issues Set to true to enable issues for this repository bool true no
has_projects Set to true to enable projects for this repository bool false no
has_wiki Set to true to enable the wiki for this repository bool false no
homepage_url URL of a page describing the project string "" no
ignore_vulnerability_alerts_during_read Set to true to ignore vulnerability alerts during read bool false no
is_template Set to true to make this repository a template bool false no
license_template Use a template for the LICENSE file string "" no
name The name of the github repository to be created string n/a yes
pages Configuration block for GitHub Pages any {} no
security_and_analysis Configuration block for security and analysis features any {} no
tags Default tags to add to resources map(any) {} no
template Configuration block for using a template repository any {} no
topics The list of topics of the repository list(string) [] no
visibility Can be public, private, or internal string "private" no
vulnerability_alerts Set to true to enable vulnerability alerts bool true no
web_commit_signoff_required Set to true to require contributors to sign off on web-based commits bool true no

Outputs

Name Description
repository_default_branch The name of the default branch of the repository.
repository_full_name A string of the form 'orgname/reponame'.
repository_git_clone_url URL that can be provided to git clone to clone the repository anonymously via the git protocol.
repository_html_url URL to the repository on the web.
repository_http_clone_url URL that can be provided to git clone to clone the repository via HTTPS.
repository_id The ID of the repository.
repository_name The name of the repository.
repository_node_id The Node ID of the repository.
repository_ssh_clone_url URL that can be provided to git clone to clone the repository via SSH.
repository_visibility The visibility of the repository.