An open API service indexing awesome lists of open source software.

https://github.com/mblomsterberg/terraform-github-repository-module

This is a Terraform module that creates a GitHub Repository based on your preference.
https://github.com/mblomsterberg/terraform-github-repository-module

github-repository terraform-module

Last synced: about 1 year ago
JSON representation

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

Awesome Lists containing this project

README

          









terraform-github-repository-module


Terraform Module for GitHub Repository creation.




Module Examples
·
Versioning







# About

# Contact
**Github** [mBlomsterberg](https://github.com/mBlomsterberg)

**Linkedin** [Mikkel Blomsterberg](https://www.linkedin.com/in/mikkel-blomsterberg-663b785a/)

# Setup

## Versioning

We use [Semantic Versioning](http://semver.org/) 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](https://github.com/github/docs/blob/main/CONTRIBUTING.md)

# Code of Conduct

This project has adopted the XXXXXX Code of Conduct. For more information see the Code of Conduct FAQ or contact [mBlomsterberg](https://github.com/mBlomsterberg) with any additional questions or comments.

# License

Licensed under the MIT license.

(back to top)

## Requirements

| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.3.0 |
| [github](#requirement\_github) | >= 5.25.0, < 6.0.0 |

## Providers

| Name | Version |
|------|---------|
| [github](#provider\_github) | >= 5.25.0, < 6.0.0 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [github_actions_secret.personal_token](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/actions_secret) | resource |
| [github_branch.this](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch) | resource |
| [github_branch_default.default](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch_default) | resource |
| [github_issue.example](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/issue) | resource |
| [github_repository.this](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository) | resource |
| [github_repository_autolink_reference.autolink](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_autolink_reference) | resource |
| [github_repository_collaborators.collaborators](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_collaborators) | resource |
| [github_repository_environment.this](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_environment) | resource |
| [github_repository_file.files](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_file) | resource |
| [github_team.team_ids](https://registry.terraform.io/providers/integrations/github/latest/docs/data-sources/team) | data source |
| [github_user.current](https://registry.terraform.io/providers/integrations/github/latest/docs/data-sources/user) | data source |
| [github_user.user_ids](https://registry.terraform.io/providers/integrations/github/latest/docs/data-sources/user) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [allow\_auto\_merge](#input\_allow\_auto\_merge) | (Optional) Set to true to allow auto-merging pull requests on the repository. | `bool` | `false` | no |
| [allow\_merge\_commit](#input\_allow\_merge\_commit) | (Optional) Set to false to disable merge commits on the repository. | `bool` | `true` | no |
| [allow\_rebase\_merge](#input\_allow\_rebase\_merge) | (Optional) Set to false to disable rebase merges on the repository. | `bool` | `false` | no |
| [allow\_squash\_merge](#input\_allow\_squash\_merge) | (Optional) Set to false to disable squash merges on the repository. | `bool` | `true` | no |
| [allow\_update\_branch](#input\_allow\_update\_branch) | (Optional) Set to true to always suggest updating pull request branches. | `bool` | `false` | no |
| [archive\_on\_destroy](#input\_archive\_on\_destroy) | (Optional) Set to true to archive the repository instead of deleting on destroy. | `bool` | `true` | no |
| [auto\_init](#input\_auto\_init) | (Optional) Set to true to produce an initial commit in the repository. | `bool` | `false` | no |
| [branch\_protection](#input\_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](#input\_codeowners) | (Optional) This is the target team or individual user account that manages the code in the repository. | `list(string)` | `null` | no |
| [collaborator\_teams](#input\_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](#input\_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](#input\_default\_branch) | (Optional) Set to true to produce an initial commit in the repository. | `string` | `null` | no |
| [delete\_branch\_on\_merge](#input\_delete\_branch\_on\_merge) | (Optional) Automatically delete head branch after a pull request is merged. Defaults to false. | `bool` | `false` | no |
| [description](#input\_description) | (Optional) A description of the repository. | `string` | `"Terraform created GitHub Repository"` | no |
| [environments](#input\_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](#input\_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](#input\_gitignore\_template) | (Optional) Use the name of the template without the extension. For example, "Haskell". | `string` | `null` | no |
| [has\_discussions](#input\_has\_discussions) | (Optional) Set to true to enable GitHub Discussions on the repository. | `bool` | `false` | no |
| [has\_issues](#input\_has\_issues) | (Optional) Set to true to enable the GitHub Issues features on the repository. | `bool` | `false` | no |
| [has\_projects](#input\_has\_projects) | (Optional) Set to true to enable the GitHub Projects features on the repository. | `bool` | `false` | no |
| [has\_wiki](#input\_has\_wiki) | (Optional) Set to true to enable the GitHub Wiki features on the repository. | `bool` | `false` | no |
| [homepage\_url](#input\_homepage\_url) | (Optional) URL of a page describing the project. | `string` | `""` | no |
| [ignore\_vulnerability\_alerts\_during\_read](#input\_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](#input\_is\_template) | (Optional) Set to true to tell GitHub that this is a template repository. | `bool` | `false` | no |
| [license\_template](#input\_license\_template) | (Optional) Use the name of the template without the extension. Default is "mit". | `string` | `"mit"` | no |
| [merge\_commit\_message](#input\_merge\_commit\_message) | (Optional) Can be PR\_BODY, PR\_TITLE, or BLANK for a default merge commit message. | `string` | `"BLANK"` | no |
| [merge\_commit\_title](#input\_merge\_commit\_title) | (Optional) Can be PR\_TITLE or MERGE\_MESSAGE for a default merge commit title. | `string` | `"PR_TITLE"` | no |
| [name](#input\_name) | (Required) The name of the repository. | `string` | n/a | yes |
| [owner](#input\_owner) | (Optional) This is the target GitHub organization or individual user account to manage. | `string` | `null` | no |
| [pages](#input\_pages) | (Optional) The repository's GitHub Pages configuration. |
object({
branch = string
path = optional(string, "/")
cname = optional(string, "")
})
| `null` | no |
| [repository\_branches](#input\_repository\_branches) | (Optional) The list of branche names to create in the repository. | `list(string)` | `[]` | no |
| [security\_and\_analysis](#input\_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](#input\_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](#input\_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](#input\_template) | (Optional) Use a template repository to create this resource. |
object({
owner = string
repository = string
include_all_branches = optional(bool, false)
})
| `null` | no |
| [token](#input\_token) | (Optional) A GitHub OAuth / Personal Access Token. | `string` | `null` | no |
| [topics](#input\_topics) | (Optional) The list of topics of the repository. | `list(string)` | `[]` | no |
| [visibility](#input\_visibility) | (Optional) Can be public or private or internal. | `string` | `"public"` | no |
| [vulnerability\_alerts](#input\_vulnerability\_alerts) | (Optional) Set to true to enable security alerts for vulnerable dependencies. | `bool` | `false` | no |

## Outputs

No outputs.