diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 5799632d..566019fe 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,13 +1,13 @@
repos:
- repo: https://github.com/mineiros-io/pre-commit-hooks
- rev: v0.2.3
+ rev: v0.3.1
hooks:
- id: terraform-fmt
- id: terraform-validate
exclude: ^examples|.terraform/
- id: tflint
- - id: gofmt
- - id: goimports
- id: golangci-lint
- id: phony-targets
- id: markdown-link-check
+ args: ['-p'] # When adding the -p flag, markdown-link-check will always with an exit code 0, even if dead links are found
+ verbose: true # Forces the output of the hook to be printed even when the hook passes.
diff --git a/Makefile b/Makefile
index 79c4acd4..35dc213f 100644
--- a/Makefile
+++ b/Makefile
@@ -108,6 +108,11 @@ help:
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
+## Generate README.md with Terradoc
+.PHONY: terradoc
+terradoc:
+ $(call quiet-command,terradoc -o README.md README.tfdoc.hcl)
+
# define helper functions
DOCKER_FLAGS += ${DOCKER_RUN_FLAGS}
DOCKER_RUN_CMD = docker run ${DOCKER_FLAGS} ${BUILD_TOOLS_DOCKER_IMAGE}
diff --git a/README.md b/README.md
index ae63e27d..83312530 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
-[
][homepage]
+[
](https://mineiros.io/?ref=terraform-github-repository)
-[![Build Status][badge-build]][build-status]
-[![GitHub tag (latest SemVer)][badge-semver]][releases-github]
-[![Terraform Version][badge-terraform]][releases-terraform]
-[![Github Provider Version][badge-tf-gh]][releases-github-provider]
-[![Join Slack][badge-slack]][slack]
+[](https://github.com/mineiros-io/terraform-github-repository/actions)
+[](https://github.com/mineiros-io/terraform-github-repository/releases)
+[](https://github.com/hashicorp/terraform/releases)
+[](https://github.com/terraform-providers/terraform-provider-github/releases)
+[](https://join.slack.com/t/mineiros-community/shared_invite/zt-ehidestg-aLGoIENLVs6tvwJ11w9WGg)
# terraform-github-repository
@@ -16,12 +16,12 @@ A [Terraform] module for creating a public or private repository on [Github].
_Security related notice: Versions 4.7.0, 4.8.0, 4.9.0 and 4.9.1 of the Terraform Github Provider are deny-listed in version constraints as a regression introduced in 4.7.0 and fixed in 4.9.2 creates public repositories from templates even if visibility is set to private._
+
- [Module Features](#module-features)
- [Getting Started](#getting-started)
- [Module Argument Reference](#module-argument-reference)
- - [Top-level Arguments](#top-level-arguments)
- - [Module Configuration](#module-configuration)
- - [Repository Configuration](#repository-configuration)
+ - [Main Resource Configuration](#main-resource-configuration)
+ - [Extended Resource Configuration](#extended-resource-configuration)
- [Repository Creation Configuration](#repository-creation-configuration)
- [Teams Configuration](#teams-configuration)
- [Collaborator Configuration](#collaborator-configuration)
@@ -31,19 +31,10 @@ _Security related notice: Versions 4.7.0, 4.8.0, 4.9.0 and 4.9.1 of the Terrafor
- [Projects Configuration](#projects-configuration)
- [Webhooks Configuration](#webhooks-configuration)
- [Secrets Configuration](#secrets-configuration)
- - [`defaults` Object Attributes](#defaults-object-attributes)
- - [`template` Object Attributes](#template-object-attributes)
- - [`pages` Object Attributes](#pages-object-attributes)
- - [`deploy_key` Object Attributes](#deploy_key-object-attributes)
- - [`branch_protection` Object Attributes](#branch_protection-object-attributes)
- - [`required_status_checks` Object Attributes](#required_status_checks-object-attributes)
- - [`required_pull_request_reviews` Object Attributes](#required_pull_request_reviews-object-attributes)
- - [`restrictions` Object Attributes](#restrictions-object-attributes)
- - [`issue_label` Object Attributes](#issue_label-object-attributes)
- - [`project` Object Attributes](#project-object-attributes)
- - [`webhook` Object Attributes](#webhook-object-attributes)
-- [Module Attributes Reference](#module-attributes-reference)
+ - [Module Configuration](#module-configuration)
+- [Module Outputs](#module-outputs)
- [External Documentation](#external-documentation)
+ - [Terraform Github Provider Documentation](#terraform-github-provider-documentation)
- [Module Versioning](#module-versioning)
- [Backwards compatibility in `0.0.z` and `0.y.z` version](#backwards-compatibility-in-00z-and-0yz-version)
- [About Mineiros](#about-mineiros)
@@ -91,7 +82,7 @@ Most basic usage creating a new private github repository.
```hcl
module "repository" {
source = "mineiros-io/repository/github"
- version = "~> 0.10.0"
+ version = "~> 0.11.0"
name = "terraform-github-repository"
license_template = "apache-2.0"
@@ -116,590 +107,738 @@ terraform {
See [variables.tf] and [examples/] for details and use-cases.
-### Top-level Arguments
-
-#### Module Configuration
-
-- **`module_depends_on`**: _(Optional `list(any)`)_
-
- Due to the fact, that terraform does not offer `depends_on` on modules as of today (v0.12.24)
- we might hit race conditions when dealing with team names instead of ids.
- So when using the feature of [adding teams by slug/name](#teams-configuration) to the repository when creating it,
- make sure to add all teams to this list as indirect dependencies.
- Default is `[]`.
-
-#### Repository Configuration
+### Main Resource Configuration
-- **`name`**: **_(Required `string`)_**
+- [**`name`**](#var-name): *(**Required** `string`)*
The name of the repository.
-- **[`defaults`](#defaults-object-attributes)**: _(Optional `object`)_
+- [**`defaults`**](#var-defaults): *(Optional `object(defaults)`)*
A object of default settings to use instead of module defaults for top-level arguments.
See below for a list of supported arguments.
- Default is `{}` - use module defaults as described in the README.
+
+ This is a special argument to set various defaults to be reused for multiple repositories.
+
+ The following top-level arguments can be set as defaults:
+ `homepage_url`,
+ `visibility`,
+ `has_issues`,
+ `has_projects`,
+ `has_wiki`,
+ `allow_merge_commit`,
+ `allow_rebase_merge`,
+ `allow_squash_merge`,
+ `has_downloads`,
+ `auto_init`,
+ `gitignore_template`,
+ `license_template`,
+ `default_branch`,
+ `topics`,
+ `issue_labels_create`,
+ `issue_labels_merge_with_github_labels`.
+
+ Module defaults are used for all arguments that are not set in `defaults`.
+ Using top level arguments override defaults set by this argument.
-- **[`pages`](#pages-object-attributes)**: _(Optional `object`)_
+ Default is `{}`.
+
+- [**`pages`**](#var-pages): *(Optional `object(pages)`)*
A object of settings to configure GitHub Pages in this repository.
See below for a list of supported arguments.
- Default is `null`.
-- **`allow_merge_commit`**: _(Optional `bool`)_
+ Default is `{}`.
+
+ The `pages` object accepts the following attributes:
+
+ - [**`branch`**](#attr-pages-branch): *(**Required** `string`)*
+
+ The repository branch used to publish the site's source files.
+
+ - [**`path`**](#attr-pages-path): *(Optional `string`)*
+
+ The repository directory from which the site publishes.
+
+ - [**`cname`**](#attr-pages-cname): *(Optional `string`)*
+
+ The custom domain for the repository. This can only be set after the
+ repository has been created.
+
+- [**`allow_merge_commit`**](#var-allow_merge_commit): *(Optional `bool`)*
Set to `false` to disable merge commits on the repository.
If you set this to `false` you have to enable either `allow_squash_merge`
or `allow_rebase_merge`.
+
Default is `true`.
-- **`allow_squash_merge`**: _(Optional `bool`)_
+- [**`allow_squash_merge`**](#var-allow_squash_merge): *(Optional `bool`)*
Set to `true` to enable squash merges on the repository.
+
Default is `false`.
-- **`allow_rebase_merge`**: _(Optional `bool`)_
+- [**`allow_rebase_merge`**](#var-allow_rebase_merge): *(Optional `bool`)*
Set to `true` to enable rebase merges on the repository.
+
Default is `false`.
-- **`description`**: _(Optional `string`)_
+- [**`description`**](#var-description): *(Optional `string`)*
A description of the repository.
+
Default is `""`.
-- **`delete_branch_on_merge`**: _(Optional `string`)_
+- [**`delete_branch_on_merge`**](#var-delete_branch_on_merge): *(Optional `bool`)*
Set to `false` to disable the automatic deletion of head branches after pull requests are merged.
- Default is `true`.
-- **`homepage_url`**: _(Optional `string`)_
+ Default is `false`.
+
+- [**`homepage_url`**](#var-homepage_url): *(Optional `string`)*
URL of a page describing the project.
+
Default is `""`.
-- ~`private`~: _(Optional `bool`)_
+- [**`private`**](#var-private): *(Optional `bool`)*
**_DEPRECATED_**: Please use `visibility` instead and update your code. parameter will be removed in a future version
-- **`visibility`**: _(Optional `string`)_
+- [**`visibility`**](#var-visibility): *(Optional `string`)*
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`.
The `visibility` parameter overrides the deprecated `private` parameter.
- Default is `private`.
- If the deprecated `private` boolean parameter is used, the default value is adjusted to respect this setting.
-- **`has_issues`**: _(Optional `bool`)_
+ Default is `"private"`.
+
+- [**`has_issues`**](#var-has_issues): *(Optional `bool`)*
Set to true to enable the GitHub Issues features on the repository.
- Default is `false`
-- **`has_projects`**: _(Optional `bool`)_
+ Default is `false`.
+
+- [**`has_projects`**](#var-has_projects): *(Optional `bool`)*
Set to true to enable the GitHub Projects features on the repository.
- Default is `false`
-- **`has_wiki`**: _(Optional `bool`)_
+ Default is `false`.
+
+- [**`has_wiki`**](#var-has_wiki): *(Optional `bool`)*
Set to true to enable the GitHub Wiki features on the repository.
- Default is `false`
-- **`has_downloads`**: _(Optional `bool`)_
+ Default is `false`.
+
+- [**`has_downloads`**](#var-has_downloads): *(Optional `bool`)*
Set to `true` to enable the (deprecated) downloads features on the repository.
+
Default is `false`.
-- **`is_template`**: _(Optional `bool`)_
+- [**`is_template`**](#var-is_template): *(Optional `bool`)*
Set to `true` to tell GitHub that this is a template repository.
+
Default is `false`.
-- **`default_branch`**: _(Optional `string`)_
+- [**`default_branch`**](#var-default_branch): *(Optional `string`)*
The name of the default branch of the repository.
- NOTE: This can only be set after a repository has already been created, and
- after a correct reference has been created for the target branch inside the repository.
- This means a user will have to omit this parameter from the initial repository creation and
- create the target branch inside of the repository prior to setting this attribute.
+ NOTE: This can only be set after a repository has already been created, and after a correct reference has been created for the target branch inside the repository.
+ This means a user will have to omit this parameter from the initial repository creation and create the target branch inside of the repository prior to setting this attribute.
+
Default is `""`.
-- **`archived`**: _(Optional `bool`)_
+- [**`archived`**](#var-archived): *(Optional `bool`)*
Specifies if the repository should be archived.
NOTE: Currently, the API does not support unarchiving.
+
Default is `false`.
-- **`topics`**: _(Optional `list(string)`)_
+- [**`topics`**](#var-topics): *(Optional `list(string)`)*
The list of topics of the repository.
+
Default is `[]`.
-- **`extra_topics`**: _(Optional `list(string)`)_
+- [**`extra_topics`**](#var-extra_topics): *(Optional `list(string)`)*
+
+ A list of additional topics of the repository. Those topics will be added to the list of `topics`. This is useful if `default.topics` are used and the list should be extended with more topics.
- A list of additional topics of the repository. Those topics will be added to
- the list of `topics`. This is useful if `default.topics` are used and the list
- should be extended with more topics.
Default is `[]`.
-- **`vulnerability_alerts`**: _(Optional `bool`)_
+- [**`vulnerability_alerts`**](#var-vulnerability_alerts): *(Optional `bool`)*
Set to `false` to disable security alerts for vulnerable dependencies.
Enabling requires alerts to be enabled on the owner level.
-- **`archive_on_destroy`**: _(Optional `bool`)_
+- [**`archive_on_destroy`**](#var-archive_on_destroy): *(Optional `bool`)*
Set to `false` to not archive the repository instead of deleting on destroy.
+ Default is `true`.
+
+### Extended Resource Configuration
+
#### Repository Creation Configuration
The following four arguments can only be set at repository creation and
changes will be ignored for repository updates and
will not show a diff in plan or apply phase.
-- **`auto_init`**: _(Optional `bool`)_
+- [**`auto_init`**](#var-auto_init): *(Optional `bool`)*
Set to `false` to not produce an initial commit in the repository.
+
Default is `true`.
-- **`gitignore_template`**: _(Optional `string`)_
+- [**`gitignore_template`**](#var-gitignore_template): *(Optional `string`)*
Use the name of the template without the extension.
- Default is `""`
-- **`license_template`**: _(Optional `string`)_
+ Default is `""`.
+
+- [**`license_template`**](#var-license_template): *(Optional `string`)*
Use the name of the template without the extension.
- Default is `""`
-- **[`template`](#template-object-attributes)**: _(Optional `object`)_
+ Default is `""`.
+
+- [**`template`**](#var-template): *(Optional `object(template)`)*
Use a template repository to create this resource.
- See [Template Object Attributes](#template-object-attributes) below for details.
+
+ Default is `{}`.
+
+ The `template` object accepts the following attributes:
+
+ - [**`owner`**](#attr-template-owner): *(**Required** `string`)*
+
+ The GitHub organization or user the template repository is owned by.
+
+ - [**`repository`**](#attr-template-repository): *(**Required** `string`)*
+
+ The name of the template repository.
#### Teams Configuration
-Your can use non-computed
-(known at `terraform plan`) team names or slugs
-(`*_teams` Attributes)
-or computed (only known in `terraform apply` phase) team IDs
-(`*_team_ids` Attributes).
+Your can use non-computed (known at `terraform plan`) team names or slugs (`*_teams` Attributes)
+or computed (only known in `terraform apply` phase) team IDs (`*_team_ids` Attributes).
**When using non-computed names/slugs teams need to exist before running plan.**
-This is due to some terraform limitation and we will update the module once terraform
-removed thislimitation.
+This is due to some terraform limitation and we will update the module once terraform removed this limitation.
-- **`pull_teams`** or **`pull_team_ids`**: _(Optional `list(string)`)_
+- [**`pull_teams`**](#var-pull_teams): *(Optional `list(string)`)*
- A list of teams to grant pull (read-only) permission.
+ Can also be `pull_team_ids`. A list of teams to grant pull (read-only) permission.
Recommended for non-code contributors who want to view or discuss your project.
+
Default is `[]`.
-- **`triage_teams`** or **`triage_team_ids`**: _(Optional `list(string)`)_
+- [**`triage_teams`**](#var-triage_teams): *(Optional `list(string)`)*
- A list of teams to grant triage permission.
+ Can also be `triage_team_ids`. A list of teams to grant triage permission.
Recommended for contributors who need to proactively manage issues and pull requests
without write access.
+
Default is `[]`.
-- **`push_teams`** or **`push_team_ids`**: _(Optional `list(string)`)_
+- [**`push_teams`**](#var-push_teams): *(Optional `list(string)`)*
- A list of teams to grant push (read-write) permission.
+ Can also be `push_team_ids`. A list of teams to grant push (read-write) permission.
Recommended for contributors who actively push to your project.
+
Default is `[]`.
-- **`maintain_teams`** or **`maintain_team_ids`**: _(Optional `list(string)`)_
+- [**`maintain_teams`**](#var-maintain_teams): *(Optional `list(string)`)*
+
+ Can also be `maintain_team_ids`. A list of teams to grant maintain permission.
+ Recommended for project managers who need to manage the repository without access to sensitive or destructive actions.
- A list of teams to grant maintain permission.
- Recommended for project managers who need to manage the repository without access
- to sensitive or destructive actions.
Default is `[]`.
-- **`admin_teams`** or **`admin_team_ids`**: _(Optional `list(string)`)_
+- [**`admin_teams`**](#var-admin_teams): *(Optional `list(string)`)*
+
+ Can also be `admin_team_ids`. A list of teams to grant admin (full) permission.
+ Recommended for people who need full access to the project, including sensitive and destructive actions like managing security or deleting a repository.
- A list of teams to grant admin (full) permission.
- Recommended for people who need full access to the project, including sensitive
- and destructive actions like managing security or deleting a repository.
Default is `[]`.
#### Collaborator Configuration
-- **`pull_collaborators`**: _(Optional `list(string)`)_
+- [**`pull_collaborators`**](#var-pull_collaborators): *(Optional `list(string)`)*
A list of user names to add as collaborators granting them pull (read-only) permission.
Recommended for non-code contributors who want to view or discuss your project.
+
Default is `[]`.
-- **`triage_collaborators`**: _(Optional `list(string)`)_
+- [**`triage_collaborators`**](#var-triage_collaborators): *(Optional `list(string)`)*
A list of user names to add as collaborators granting them triage permission.
- Recommended for contributors who need to proactively manage issues and pull requests
- without write access.
+ Recommended for contributors who need to proactively manage issues and pull requests without write access.
+
Default is `[]`.
-- **`push_collaborators`**: _(Optional `list(string)`)_
+- [**`push_collaborators`**](#var-push_collaborators): *(Optional `list(string)`)*
A list of user names to add as collaborators granting them push (read-write) permission.
Recommended for contributors who actively push to your project.
+
Default is `[]`.
-- **`maintain_collaborators`**: _(Optional `list(string)`)_
+- [**`maintain_collaborators`**](#var-maintain_collaborators): *(Optional `list(string)`)*
A list of user names to add as collaborators granting them maintain permission.
- Recommended for project managers who need to manage the repository without access
- to sensitive or destructive actions.
+ Recommended for project managers who need to manage the repository without access to sensitive or destructive actions.
+
Default is `[]`.
-- **`admin_collaborators`**: _(Optional `list(string)`)_
+- [**`admin_collaborators`**](#var-admin_collaborators): *(Optional `list(string)`)*
A list of user names to add as collaborators granting them admin (full) permission.
- Recommended for people who need full access to the project, including sensitive
- and destructive actions like managing security or deleting a repository.
+ Recommended for people who need full access to the project, including sensitive and destructive actions like managing security or deleting a repository.
+
Default is `[]`.
#### Deploy Keys Configuration
-- **[`deploy_keys`](#deploy_key-object-attributes)**: _(Optional `list(deploy_key|string)`)_
+- [**`deploy_keys`**](#var-deploy_keys): *(Optional `list(deploy_key)`)*
+
+ Can also be type `string`. Specifies deploy keys and access-level of deploy keys used in this repository.
+ Every `string` in the list will be converted internally into the `object` representation with the `key` argument being set to the `string`. `object` details are explained below.
- Specifies deploy keys and access-level of deploy keys used in this repository.
- Every `string` in the list will be converted internally into the `object`
- representation with the `key` argument being set to the `string`.
- `object` details are explained below.
Default is `[]`.
-- **[`deploy_keys_computed`](#deploy_key-object-attributes)**: _(Optional `list(deploy_key|string)`)_
+ Each `deploy_key` object in the list accepts the following attributes:
+
+ - [**`key`**](#attr-deploy_keys-key): *(**Required** `string`)*
+
+ The SSH public key.
+
+ - [**`title`**](#attr-deploy_keys-title): *(Optional `string`)*
+
+ A Title for the key.
+ Default is the comment field of SSH public key if it is not empty else it defaults to `md5(key)`.
+
+ - [**`read_only`**](#attr-deploy_keys-read_only): *(Optional `bool`)*
+
+ Specifies the level of access for the key.
+
+ Default is `true`.
+
+ - [**`id`**](#attr-deploy_keys-id): *(Optional `string`)*
+
+ Specifies an ID which is used to prevent resource recreation when the order in the list of deploy keys changes.
+ The ID must be unique between `deploy_keys` and `deploy_keys_computed`.
+
+ Default is `"md5(key)"`.
+
+- [**`deploy_keys_computed`**](#var-deploy_keys_computed): *(Optional `list(deploy_key)`)*
+
+ Can also be type `string`. Same as `deploy_keys` argument with the following differences:
+ Use this argument if you depend on computed keys that terraform can not use in resource `for_each` execution. Downside of this is the recreation of deploy key resources whenever the order in the list changes. **Prefer `deploy_keys` whenever possible.**
+ This argument does **not** conflict with `deploy_keys` and should exclusively be used for computed resources.
- Same as `deploy_keys` argument with the following differences:
- Use this argument if you depend on computed keys that terraform can not use in
- resource `for_each` execution. Downside of this is the recreation of deploy key
- resources whenever the order in the list changes. **Prefer `deploy_keys` whenever possible.**
- This argument does **not** conflict with `deploy_keys` and should exclusively be
- used for computed resources.
Default is `[]`.
+ Each `deploy_key` object in the list accepts the following attributes:
+
+ - [**`key`**](#attr-deploy_keys_computed-key): *(**Required** `string`)*
+
+ The SSH public key.
+
+ - [**`title`**](#attr-deploy_keys_computed-title): *(Optional `string`)*
+
+ A Title for the key.
+ Default is the comment field of SSH public key if it is not empty else it defaults to `md5(key)`.
+
+ - [**`read_only`**](#attr-deploy_keys_computed-read_only): *(Optional `bool`)*
+
+ Specifies the level of access for the key.
+
+ Default is `true`.
+
+ - [**`id`**](#attr-deploy_keys_computed-id): *(Optional `string`)*
+
+ Specifies an ID which is used to prevent resource recreation when the order in the list of deploy keys changes.
+ The ID must be unique between `deploy_keys` and `deploy_keys_computed`.
+
+ Default is `"md5(key)"`.
+
#### Branch Protections Configuration
-- **[`branch_protections_v3`](#branch_protection-object-attributes)**: _(Optional `list(branch_protection)`)_
+- [**`branch_protections_v3`**](#var-branch_protections_v3): *(Optional `list(branch_protection)`)*
This resource allows you to configure branch protection for repositories in your organization.
When applied, the branch will be protected from forced pushes and deletion.
- Additional constraints, such as required status checks or restrictions on users and teams,
- can also be configured.
- Default is `[]` unless `branch_protections` is used.
+ Additional constraints, such as required status checks or restrictions on users and teams, can also be configured.
+
+ Default is `[]`.
+
+ Each `branch_protection` object in the list accepts the following attributes:
+
+ - [**`branch`**](#attr-branch_protections_v3-branch): *(**Required** `string`)*
+
+ The Git branch to protect.
+
+ - [**`enforce_admins`**](#attr-branch_protections_v3-enforce_admins): *(Optional `bool`)*
+
+ Setting this to true enforces status checks for repository administrators.
+
+ Default is `false`.
+
+ - [**`require_signed_commits`**](#attr-branch_protections_v3-require_signed_commits): *(Optional `bool`)*
+
+ Setting this to true requires all commits to be signed with GPG.
+
+ Default is `false`.
+
+ - [**`required_status_checks`**](#attr-branch_protections_v3-required_status_checks): *(Optional `object(required_status_checks)`)*
+
+ Enforce restrictions for required status checks.
+ See Required Status Checks below for details.
+
+ Default is `{}`.
+
+ The `required_status_checks` object accepts the following attributes:
+
+ - [**`strict`**](#attr-branch_protections_v3-required_status_checks-strict): *(Optional `bool`)*
+
+ Require branches to be up to date before merging.
+
+ Default is `false`.
-- **[`branch_protections`](#branch_protection-object-attributes)**: **_(DEPRECATED)_**
+ - [**`contexts`**](#attr-branch_protections_v3-required_status_checks-contexts): *(Optional `list(string)`)*
+
+ The list of status checks to require in order to merge into this branch. If default is `[]` no status checks are required.
+
+ Default is `[]`.
+
+ - [**`required_pull_request_reviews`**](#attr-branch_protections_v3-required_pull_request_reviews): *(Optional `object(required_pull_request_reviews)`)*
+
+ Enforce restrictions for pull request reviews.
+
+ Default is `{}`.
+
+ The `required_pull_request_reviews` object accepts the following attributes:
+
+ - [**`dismiss_stale_reviews`**](#attr-branch_protections_v3-required_pull_request_reviews-dismiss_stale_reviews): *(Optional `bool`)*
+
+ Dismiss approved reviews automatically when a new commit is pushed.
+
+ Default is `true`.
+
+ - [**`dismissal_users`**](#attr-branch_protections_v3-required_pull_request_reviews-dismissal_users): *(Optional `list(string)`)*
+
+ The list of user logins with dismissal access
+
+ Default is `[]`.
+
+ - [**`dismissal_teams`**](#attr-branch_protections_v3-required_pull_request_reviews-dismissal_teams): *(Optional `list(string)`)*
+
+ The list of team slugs with dismissal access.
+ Always use slug of the team, not its name.
+ Each team already has to have access to the repository.
+
+ Default is `[]`.
+
+ - [**`require_code_owner_reviews`**](#attr-branch_protections_v3-required_pull_request_reviews-require_code_owner_reviews): *(Optional `bool`)*
+
+ Require an approved review in pull requests including files with a designated code owner.
+
+ Default is `false`.
+
+ - [**`restrictions`**](#attr-branch_protections_v3-restrictions): *(Optional `object(restrictions)`)*
+
+ Enforce restrictions for the users and teams that may push to the branch - only available for organization-owned repositories. See Restrictions below for details.
+
+ Default is `{}`.
+
+ The `restrictions` object accepts the following attributes:
+
+ - [**`users`**](#attr-branch_protections_v3-restrictions-users): *(Optional `list(string)`)*
+
+ The list of user logins with push access.
+
+ Default is `[]`.
+
+ - [**`teams`**](#attr-branch_protections_v3-restrictions-teams): *(Optional `list(string)`)*
+
+ The list of team slugs with push access.
+ Always use slug of the team, not its name.
+ Each team already has to have access to the repository.
+
+ Default is `[]`.
+
+ - [**`apps`**](#attr-branch_protections_v3-restrictions-apps): *(Optional `list(string)`)*
+
+ The list of app slugs with push access.
+
+ Default is `[]`.
+
+- [**`branch_protections`**](#var-branch_protections): *(Optional `list(branch_protection)`)*
**_DEPRECATED_** To ensure compatibility with future versions of this module, please use `branch_protections_v3`.
This argument is ignored if `branch_protections_v3` is used.
+
Default is `[]`.
-#### Issue Labels Configuration
+ Each `branch_protection` object in the list accepts the following attributes:
-- **[`issue_labels`](#issue_label-object-attributes)**: _(Optional `list(issue_label)`)_
+ - [**`branch`**](#attr-branch_protections-branch): *(**Required** `string`)*
- This resource allows you to create and manage issue labels within your GitHub organization.
- Issue labels are keyed off of their "name", so pre-existing issue labels result
- in a 422 HTTP error if they exist outside of Terraform.
- Normally this would not be an issue, except new repositories are created with a
- "default" set of labels, and those labels easily conflict with custom ones.
- This resource will first check if the label exists, and then issue an update,
- otherwise it will create.
- Default is `[]`.
+ The Git branch to protect.
-- **[`issue_labels_merge_with_github_labels`](#issue_label-object-attributes)**: _(Optional `bool`)_
+ - [**`enforce_admins`**](#attr-branch_protections-enforce_admins): *(Optional `bool`)*
- Specify if github default labels will be handled by terraform. This should be decided on upon creation of the repository. If you later decide to disable this feature, github default labels will be destroyed if not
- replaced by labels set in `issue_labels` argument.
- Default is `true`.
+ Setting this to true enforces status checks for repository administrators.
-- **[`issue_labels_create`](#issue_label-object-attributes)**: _(Optional `bool`)_
+ Default is `false`.
- Specify whether you want to force or suppress the creation of issues labels.
- Default is `true` if `has_issues` is `true` or `issue_labels` is non-empty, otherwise default is `false`.
+ - [**`require_signed_commits`**](#attr-branch_protections-require_signed_commits): *(Optional `bool`)*
-#### Projects Configuration
+ Setting this to true requires all commits to be signed with GPG.
-- **[`projects`](#project-object-attributes)**: _(Optional `list(project)`)_
+ Default is `false`.
- This resource allows you to create and manage projects for GitHub repository.
- Default is `[]`.
+ - [**`required_status_checks`**](#attr-branch_protections-required_status_checks): *(Optional `object(required_status_checks)`)*
-#### Webhooks Configuration
+ Enforce restrictions for required status checks.
+ See Required Status Checks below for details.
-- **[`webhooks`](#webhook-object-attributes)**: _(Optional `list(webhook)`)_
+ Default is `{}`.
- This resource allows you to create and manage webhooks for repositories in your organization.
- When applied, a webhook will be created which specifies a URL to receive events and which events
- to receieve. Additional constraints, such as SSL verification, pre-shared secret and content type
- can also be configured
- Default is `[]`.
+ The `required_status_checks` object accepts the following attributes:
-#### Secrets Configuration
+ - [**`strict`**](#attr-branch_protections-required_status_checks-strict): *(Optional `bool`)*
-- **`plaintext_secrets`**: _(Optional `map(string)`)_
+ Require branches to be up to date before merging.
+ Defaults is `false`.
- This map allows you to create and manage secrets for repositories in your organization.
- Each element in the map is considered a secret to be managed, being the key map the secret name and the value the corresponding secret in plain text:
+ - [**`contexts`**](#attr-branch_protections-required_status_checks-contexts): *(Optional `list(string)`)*
- ```
- plaintext_secrets = {
- SECRET_NAME_1 = "secret_value_1"
- SECRET_NAME_2 = "secret_value_2"
- ...
- }
- ```
+ The list of status checks to require in order to merge into this branch. If default is `[]` no status checks are required.
- When applied, a secret with the given key and value will be created in the repositories.
- The value of the secrets must be given in plain text, github provider is in charge of encrypting it.
- **Attention:** You might want to get secrets via a data source from a secure vault and not add them in plain text to your source files; so you do not commit plaintext secrets into the git repository managing your github account.
- Default is `{}`.
+ Default is `[]`.
-#### [`defaults`](#repository-configuration) Object Attributes
+ - [**`required_pull_request_reviews`**](#attr-branch_protections-required_pull_request_reviews): *(Optional `object(required_pull_request_reviews)`)*
-This is a special argument to set various defaults to be reused for multiple repositories.
-The following top-level arguments can be set as defaults:
-`homepage_url`,
-`visibility`,
-`has_issues`,
-`has_projects`,
-`has_wiki`,
-`allow_merge_commit`,
-`allow_rebase_merge`,
-`allow_squash_merge`,
-`has_downloads`,
-`auto_init`,
-`gitignore_template`,
-`license_template`,
-`default_branch`,
-`topics`,
-`issue_labels_create`,
-`issue_labels_merge_with_github_labels`.
-Module defaults are used for all arguments that are not set in `defaults`.
-Using top level arguments override defaults set by this argument.
-Default is `{}`.
+ Enforce restrictions for pull request reviews.
-#### [`pages`](#pages-object-attributes) Object Attributes
+ Default is `{}`.
-This block is used for configuring GitHub Pages for the repository.
-The following top-level arguments must be set to configure GitHub Pages for
-the repository:
+ The `required_pull_request_reviews` object accepts the following attributes:
-- **`branch`**: **_(Required `string`)_**
+ - [**`dismiss_stale_reviews`**](#attr-branch_protections-required_pull_request_reviews-dismiss_stale_reviews): *(Optional `bool`)*
- The repository branch used to publish the site's source files.
+ Dismiss approved reviews automatically when a new commit is pushed.
-- **`path`**: **_(Optional `string`)_**
+ Default is `true`.
- The repository directory from which the site publishes.
+ - [**`dismissal_users`**](#attr-branch_protections-required_pull_request_reviews-dismissal_users): *(Optional `list(string)`)*
-- **`cname`**: **_(Optional `string`)_**
+ The list of user logins with dismissal access
- The custom domain for the repository. This can only be set after the
- repository has been created.
- Default is `null`.
+ Default is `[]`.
-#### [`template`](#repository-creation-configuration) Object Attributes
+ - [**`dismissal_teams`**](#attr-branch_protections-required_pull_request_reviews-dismissal_teams): *(Optional `list(string)`)*
-- **`owner`**: **_(Required `string`)_**
+ The list of team slugs with dismissal access.
+ Always use slug of the team, not its name.
+ Each team already has to have access to the repository.
- The GitHub organization or user the template repository is owned by.
+ Default is `[]`.
-- **`repository`**: **_(Required `string`)_**
+ - [**`require_code_owner_reviews`**](#attr-branch_protections-required_pull_request_reviews-require_code_owner_reviews): *(Optional `bool`)*
- The name of the template repository.
+ Require an approved review in pull requests including files with a designated code owner.
-#### [`deploy_key`](#deploy-keys-configuration) Object Attributes
+ Default is `false`.
-- **`key`**: **_(Required `string`)_**
+ - [**`restrictions`**](#attr-branch_protections-restrictions): *(Optional `object(restrictions)`)*
- The SSH public key.
+ Enforce restrictions for the users and teams that may push to the branch - only available for organization-owned repositories. See Restrictions below for details.
-- **`title`**: _(Optional `string`)_
+ Default is `{}`.
- A Title for the key.
- Default is the comment field of SSH public key if it is not empty else it defaults to
- `md5(key)`.
+ The `restrictions` object accepts the following attributes:
-- **`read_only`**: _(Optional `bool`)_
+ - [**`users`**](#attr-branch_protections-restrictions-users): *(Optional `list(string)`)*
- Specifies the level of access for the key.
- Default is `true`.
+ The list of user logins with push access.
-- **`id`**: _(Optional `string`)_
+ Default is `[]`.
- Specifies an ID which is used to prevent resource recreation when the order in
- the list of deploy keys changes.
- The ID must be unique between `deploy_keys` and `deploy_keys_computed`.
- Default is `md5(key)`.
+ - [**`teams`**](#attr-branch_protections-restrictions-teams): *(Optional `list(string)`)*
-#### [`branch_protection`](#branch-protections-configuration) Object Attributes
+ The list of team slugs with push access.
+ Always use slug of the team, not its name.
+ Each team already has to have access to the repository.
-- **`branch`**: **_(Required `string`)_**
+ Default is `[]`.
- The Git branch to protect.
+ - [**`apps`**](#attr-branch_protections-restrictions-apps): *(Optional `list(string)`)*
-- **`enforce_admins`**: _(Optional `bool`)_
+ The list of app slugs with push access.
- Setting this to true enforces status checks for repository administrators.
- Default is `false`.
+ Default is `[]`.
-- **`require_signed_commits`**: _(Optional `bool`)_
+#### Issue Labels Configuration
- Setting this to true requires all commits to be signed with GPG.
- Default is `false`.
+- [**`issue_labels`**](#var-issue_labels): *(Optional `list(issue_label)`)*
-- **`required_status_checks`**: _(Optional `required_status_checks`)_
+ This resource allows you to create and manage issue labels within your GitHub organization.
+ Issue labels are keyed off of their "name", so pre-existing issue labels result in a 422 HTTP error if they exist outside of Terraform.
+ Normally this would not be an issue, except new repositories are created with a "default" set of labels, and those labels easily conflict with custom ones.
+ This resource will first check if the label exists, and then issue an update, otherwise it will create.
- Enforce restrictions for required status checks.
- See Required Status Checks below for details.
- Default is `{}`.
+ Default is `[]`.
-- **`required_pull_request_reviews`**: _(Optional `required_pull_request_reviews`)_
+ Each `issue_label` object in the list accepts the following attributes:
- Enforce restrictions for pull request reviews.
- See Required Pull Request Reviews below for details.
- Default is `{}`.
+ - [**`name`**](#attr-issue_labels-name): *(**Required** `string`)*
-- **`restrictions`**: _(Optional `restrictions`)_
+ The name of the label.
- Enforce restrictions for the users and teams that may push to the branch -
- only available for organization-owned repositories. See Restrictions below for details.
- Default is `{}`.
+ - [**`color`**](#attr-issue_labels-color): *(**Required** `string`)*
-##### [`required_status_checks`](#branch_protection-object-attributes) Object Attributes
+ A 6 character hex code, without the leading `#`, identifying the color of the label.
-- **`strict`**: _(Optional `bool`)_
+ - [**`description`**](#attr-issue_labels-description): *(Optional `string`)*
- Require branches to be up to date before merging.
- Defaults is `false`.
+ A short description of the label.
-- **`contexts`**: _(Optional `list(string)`)_
+ Default is `""`.
- The list of status checks to require in order to merge into this branch.
- Default is `[]` - No status checks are required.
+ - [**`id`**](#attr-issue_labels-id): *(Optional `string`)*
-##### [`required_pull_request_reviews`](#branch_protection-object-attributes) Object Attributes
+ Specifies an ID which is used to prevent resource recreation when the order in the list of issue labels changes.
-- **`dismiss_stale_reviews`**: _(Optional `bool`)_
+ Default is `"name"`.
- Dismiss approved reviews automatically when a new commit is pushed.
- Default is `true`.
+- [**`issue_labels_merge_with_github_labels`**](#var-issue_labels_merge_with_github_labels): *(Optional `bool`)*
-- **`dismissal_users`**: _(Optional `list(string)`)_
+ Specify if github default labels will be handled by terraform. This should be decided on upon creation of the repository. If you later decide to disable this feature, github default labels will be destroyed if not replaced by labels set in `issue_labels` argument.
- The list of user logins with dismissal access
- Default is `[]`.
+- [**`issue_labels_create`**](#var-issue_labels_create): *(Optional `bool`)*
-- **`dismissal_teams`**: _(Optional `list(string)`)_
+ Specify whether you want to force or suppress the creation of issues labels.
+ Default is `true` if `has_issues` is `true` or `issue_labels` is non-empty.
- The list of team slugs with dismissal access.
- Always use slug of the team, not its name.
- Each team already has to have access to the repository.
- Default is `[]`.
+#### Projects Configuration
-- **`require_code_owner_reviews`**: _(Optional `bool`)_
+- [**`projects`**](#var-projects): *(Optional `list(project)`)*
- Require an approved review in pull requests including files with a designated code owner.
- Defaults is `false`.
+ This resource allows you to create and manage projects for GitHub repository.
-- **`required_approving_review_count`**: _(Optional `number`)_
+ Default is `[]`.
- Require x number of approvals to satisfy branch protection requirements.
- If this is specified it must be a number between 1-6.
- This requirement matches Github's API, see the upstream documentation for more information.
- Default is no approving reviews are required.
+ Each `project` object in the list accepts the following attributes:
-##### [`restrictions`](#branch_protection-object-attributes) Object Attributes
+ - [**`name`**](#attr-projects-name): *(**Required** `string`)*
-- **`users`**: _(Optional `list(string)`)_
+ The name of the project.
- The list of user logins with push access.
- Default is `[]`.
+ - [**`body`**](#attr-projects-body): *(Optional `string`)*
-- **`teams`**: _(Optional `list(string)`)_
+ The body of the project.
- The list of team slugs with push access.
- Always use slug of the team, not its name.
- Each team already has to have access to the repository.
- Default is `[]`.
+ Default is `""`.
-- **`apps`**: _(Optional `list(string)`)_
+ - [**`id`**](#attr-projects-id): *(Optional `string`)*
- The list of app slugs with push access.
- Default is `[]`.
+ Specifies an ID which is used to prevent resource recreation when the order in the list of projects changes.
-#### [`issue_label`](#issue-labels-configuration) Object Attributes
+ Default is `"name"`.
-- **`name`**: **_(Required `string`)_**
+#### Webhooks Configuration
- The name of the label.
+- [**`webhooks`**](#var-webhooks): *(Optional `list(webhook)`)*
-- **`color`**: **_(Required `string`)_**
+ This resource allows you to create and manage webhooks for repositories in your organization.
+ When applied, a webhook will be created which specifies a URL to receive events and which events to receieve. Additional constraints, such as SSL verification, pre-shared secret and content type can also be configured
- A 6 character hex code, without the leading #, identifying the color of the label.
+ Default is `[]`.
-- **`description`**: _(Optional `string`)_
+ Each `webhook` object in the list accepts the following attributes:
- A short description of the label.
- Default is `""`.
+ - [**`events`**](#attr-webhooks-events): *(**Required** `list(string)`)*
-- **`id`**: _(Optional `string`)_
+ A list of events which should trigger the webhook. [See a list of available events.](https://developer.github.com/v3/activity/events/types/)
- Specifies an ID which is used to prevent resource recreation when the order in
- the list of issue labels changes.
- Default is `name`.
+ - [**`url`**](#attr-webhooks-url): *(**Required** `string`)*
-#### [`project`](#projects-configuration) Object Attributes
+ The URL to which the payloads will be delivered.
-- **`name`**: **_(Required `string`)_**
+ - [**`active`**](#attr-webhooks-active): *(Optional `bool`)*
- The name of the project.
+ Indicate if the webhook should receive events. Defaults to `true`.
-- **`body`**: _(Optional `string`)_
+ - [**`content_type`**](#attr-webhooks-content_type): *(Optional `string`)*
- The body of the project.
- Default is `""`.
+ The media type used to serialize the payloads. Supported values include `json` and `form`.
-- **`id`**: _(Optional `string`)_
+ Default is `"form"`.
- Specifies an ID which is used to prevent resource recreation when the order in
- the list of projects changes.
- Default is `name`.
+ - [**`secret`**](#attr-webhooks-secret): *(Optional `string`)*
-#### [`webhook`](#webhooks-configuration) Object Attributes
+ If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value in the [X-Hub-Signature](https://developer.github.com/webhooks/#delivery-headers) header.
-- **`events`**: **_(Required `list(string)`)_**
+ - [**`insecure_ssl`**](#attr-webhooks-insecure_ssl): *(Optional `bool`)*
- A list of events which should trigger the webhook. [See a list of available events.](https://developer.github.com/v3/activity/events/types/)
+ Determines whether the SSL certificate of the host for `url` will be verified when delivering payloads. Supported values include `0` (verification is performed) and `1` (verification is not performed). The default is `0`. **We strongly recommend not setting this to `1` as you are subject to man-in-the-middle and other attacks.**
-- **`url`**: **_(Required `string`)_**
+#### Secrets Configuration
- The URL to which the payloads will be delivered.
+- [**`plaintext_secrets`**](#var-plaintext_secrets): *(Optional `map(string)`)*
-- **`active`**: _(Optional `bool`)_
+ This map allows you to create and manage secrets for repositories in your organization.
+ Each element in the map is considered a secret to be managed, being the key map the secret name and the value the corresponding secret in plain text:
+
+ ```
+ plaintext_secrets = {
+ SECRET_NAME_1 = "secret_value_1"
+ SECRET_NAME_2 = "secret_value_2"
+ ...
+ }
+ ```
+
+ When applied, a secret with the given key and value will be created in the repositories.
+ The value of the secrets must be given in plain text, github provider is in charge of encrypting it.
+ **Attention:** You might want to get secrets via a data source from a secure vault and not add them in plain text to your source files; so you do not commit plaintext secrets into the git repository managing your github account.
- Indicate if the webhook should receive events. Defaults to `true`.
+ Default is `{}`.
-- **`content_type`**: _(Optional `string`)_
+- [**`required_approving_review_count`**](#var-required_approving_review_count): *(Optional `number`)*
- The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`.
+ Require x number of approvals to satisfy branch protection requirements.
+ If this is specified it must be a number between 1-6.
+ This requirement matches Github's API, see the upstream documentation for more information.
+ Default is no approving reviews are required.
-- **`secret`**: _(Optional `string`)_
+### Module Configuration
- If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value in the `[X-Hub-Signature](https://developer.github.com/webhooks/#delivery-headers)` header.
+- [**`module_depends_on`**](#var-module_depends_on): *(Optional `list(any)`)*
-- **`insecure_ssl`**: _(Optional `bool`)_
+ Due to the fact, that terraform does not offer `depends_on` on modules as of today (v0.12.24)
+ we might hit race conditions when dealing with team names instead of ids.
+ So when using the feature of [adding teams by slug/name](#teams-configuration) to the repository when creating it,
+ make sure to add all teams to this list as indirect dependencies.
- Determines whether the SSL certificate of the host for `url` will be verified when delivering payloads. Supported values include `0` (verification is performed) and `1` (verification is not performed). The default is `0`. **We strongly recommend not setting this to `1` as you are subject to man-in-the-middle and other attacks.**
+ Default is `[]`.
-## Module Attributes Reference
+## Module Outputs
The following attributes are exported by the module:
- **`repository`**
- All repository attributes as returned by the
- [`github_repository`] resource
- containing all arguments as specified above and the other attributes as specified below.
+ All repository attributes as returned by the [`github_repository`] resource containing all arguments as specified above and the other attributes as specified below.
- **`full_name`**
@@ -728,22 +867,32 @@ The following attributes are exported by the module:
- **`deploy_keys`**
- A merged map of deploy key objects for the keys originally passed via `deploy_keys` and
- `deploy_keys_computed` as returned by the [`github_repository_deploy_key`] resource
- keyed by the input `id` of the key.
+ A merged map of deploy key objects for the keys originally passed via `deploy_keys` and `deploy_keys_computed` as returned by the [`github_repository_deploy_key`] resource keyed by the input `id` of the key.
- **`projects`**
- A map of Project objects keyed by the `id` of the project as returned by the
- [`github_repository_project`] resource
+ A map of Project objects keyed by the `id` of the project as returned by the [`github_repository_project`] resource
+
+- **`issue_labels`**
+
+ A map of issue labels keyed by label input id or name.
+
+- **`webhooks`**
+
+ All attributes and arguments as returned by the github_repository_webhook resource.
+
+- **`secrets`**
+
+ List of secrets available.
## External Documentation
-- Terraform Github Provider Documentation:
- - https://www.terraform.io/docs/providers/github/r/repository.html
- - https://www.terraform.io/docs/providers/github/r/repository_collaborator.html
- - https://www.terraform.io/docs/providers/github/r/repository_deploy_key.html
- - https://www.terraform.io/docs/providers/github/r/repository_project.html
+### Terraform Github Provider Documentation
+
+- https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository
+- https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_collaborator
+- https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_deploy_key
+- https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_project
## Module Versioning
@@ -762,14 +911,15 @@ Given a version number `MAJOR.MINOR.PATCH`, we increment the:
## About Mineiros
-Mineiros is a [DevOps as a Service][homepage] company based in Berlin, Germany.
-We offer commercial support for all of our projects and encourage you to reach out
-if you have any questions or need help. Feel free to send us an email at [hello@mineiros.io] or join our [Community Slack channel][slack].
+[Mineiros][homepage] is a remote-first company headquartered in Berlin, Germany
+that solves development, automation and security challenges in cloud infrastructure.
-We can also help you with:
+Our vision is to massively reduce time and overhead for teams to manage and
+deploy production-grade and secure cloud infrastructure.
-- Terraform modules for all types of infrastructure such as VPCs, Docker clusters, databases, logging and monitoring, CI, etc.
-- Consulting & training on AWS, Terraform and DevOps
+We offer commercial support for all of our modules and encourage you to reach out
+if you have any questions or need help. Feel free to email us at [hello@mineiros.io] or join our
+[Community Slack channel][slack].
## Reporting Issues
@@ -792,7 +942,8 @@ Run `make help` to see details on each available target.
This module is licensed under the Apache License Version 2.0, January 2004.
Please see [LICENSE] for full details.
-Copyright © 2021 [Mineiros GmbH][homepage]
+Copyright © 2020-2022 [Mineiros GmbH][homepage]
+
diff --git a/README.tfdoc.hcl b/README.tfdoc.hcl
new file mode 100644
index 00000000..8065f959
--- /dev/null
+++ b/README.tfdoc.hcl
@@ -0,0 +1,1320 @@
+header {
+ image = "https://raw.githubusercontent.com/mineiros-io/brand/3bffd30e8bdbbde32c143e2650b2faa55f1df3ea/mineiros-primary-logo.svg"
+ url = "https://mineiros.io/?ref=terraform-github-repository"
+
+ badge "build" {
+ image = "https://github.com/mineiros-io/terraform-github-repository/workflows/CI/CD%20Pipeline/badge.svg"
+ url = "https://github.com/mineiros-io/terraform-github-repository/actions"
+ text = "Build Status"
+ }
+
+ badge "semver)" {
+ image = "https://img.shields.io/github/v/tag/mineiros-io/terraform-github-repository.svg?label=latest&sort=semver"
+ url = "https://github.com/mineiros-io/terraform-github-repository/releases"
+ text = "GitHub tag (latest SemVer)"
+ }
+
+ badge "terraform" {
+ image = "https://img.shields.io/badge/terraform-1.x-623CE4.svg?logo=terraform"
+ url = "https://github.com/hashicorp/terraform/releases"
+ text = "Terraform Version"
+ }
+
+ badge "tf-gh" {
+ image = "https://img.shields.io/badge/GH-4.10+-F8991D.svg?logo=terraform"
+ url = "https://github.com/terraform-providers/terraform-provider-github/releases"
+ text = "Github Provider Version"
+ }
+
+ badge "slack" {
+ image = "https://img.shields.io/badge/slack-@mineiros--community-f32752.svg?logo=slack"
+ url = "https://join.slack.com/t/mineiros-community/shared_invite/zt-ehidestg-aLGoIENLVs6tvwJ11w9WGg"
+ text = "Join Slack"
+ }
+}
+
+section {
+ title = "terraform-github-repository"
+ toc = true
+ content = <<-END
+ A [Terraform] module for creating a public or private repository on [Github].
+
+ **_This module supports Terraform v1.x and is compatible with the Official Terraform GitHub Provider v4.10 and above from `integrations/github`._**
+
+ **Attention: This module is incompatible with the Hashicorp GitHub Provider! The latest version of this module supporting `hashicorp/github` provider is `~> 0.10.0`**
+
+ _Security related notice: Versions 4.7.0, 4.8.0, 4.9.0 and 4.9.1 of the Terraform Github Provider are deny-listed in version constraints as a regression introduced in 4.7.0 and fixed in 4.9.2 creates public repositories from templates even if visibility is set to private._
+ END
+
+ section {
+ title = "Module Features"
+ content = <<-END
+ In contrast to the plain `github_repository` resource this module enables various other
+ features like Branch Protection or Collaborator Management.
+
+ - **Default Security Settings**:
+ This module creates a `private` repository by default,
+ Deploy keys are `read-only` by default
+
+ - **Standard Repository Features**:
+ Setting basic Metadata,
+ Merge Strategy,
+ Auto Init,
+ License Template,
+ Gitignore Template,
+ Template Repository
+
+ - **Extended Repository Features**:
+ Branch Protection,
+ Issue Labels,
+ Handle Github Default Issue Labels,
+ Collaborators,
+ Teams,
+ Deploy Keys,
+ Projects,
+ Repository Webhooks
+
+ - _Features not yet implemented_:
+ Project Columns support,
+ Actions,
+ Repository File
+ END
+ }
+
+ section {
+ title = "Getting Started"
+ content = <<-END
+ Most basic usage creating a new private github repository.
+
+ ```hcl
+ module "repository" {
+ source = "mineiros-io/repository/github"
+ version = "~> 0.11.0"
+
+ name = "terraform-github-repository"
+ license_template = "apache-2.0"
+ gitignore_template = "Terraform"
+ }
+
+ provider "github" {}
+
+ terraform {
+ required_version = "~> 1.0"
+
+ required_providers {
+ github = {
+ source = "integrations/github"
+ version = "~> 4.0"
+ }
+ }
+ }
+ ```
+ END
+ }
+
+ section {
+ title = "Module Argument Reference"
+ content = <<-END
+ See [variables.tf] and [examples/] for details and use-cases.
+ END
+
+ section {
+ title = "Main Resource Configuration"
+
+ variable "name" {
+ required = true
+ type = string
+ description = <<-END
+ The name of the repository.
+ END
+ }
+
+ variable "defaults" {
+ type = object(defaults)
+ default = {}
+ description = <<-END
+ A object of default settings to use instead of module defaults for top-level arguments.
+ See below for a list of supported arguments.
+
+ This is a special argument to set various defaults to be reused for multiple repositories.
+
+ The following top-level arguments can be set as defaults:
+ `homepage_url`,
+ `visibility`,
+ `has_issues`,
+ `has_projects`,
+ `has_wiki`,
+ `allow_merge_commit`,
+ `allow_rebase_merge`,
+ `allow_squash_merge`,
+ `has_downloads`,
+ `auto_init`,
+ `gitignore_template`,
+ `license_template`,
+ `default_branch`,
+ `topics`,
+ `issue_labels_create`,
+ `issue_labels_merge_with_github_labels`.
+
+ Module defaults are used for all arguments that are not set in `defaults`.
+ Using top level arguments override defaults set by this argument.
+ END
+ }
+
+ variable "pages" {
+ type = object(pages)
+ default = {}
+ description = <<-END
+ A object of settings to configure GitHub Pages in this repository.
+ See below for a list of supported arguments.
+ END
+
+ attribute "branch" {
+ required = true
+ type = string
+ description = <<-END
+ The repository branch used to publish the site's source files.
+ END
+ }
+
+ attribute "path" {
+ type = string
+ description = <<-END
+ The repository directory from which the site publishes.
+ END
+ }
+
+ attribute "cname" {
+ type = string
+ description = <<-END
+ The custom domain for the repository. This can only be set after the
+ repository has been created.
+ END
+ }
+ }
+
+ variable "allow_merge_commit" {
+ type = bool
+ default = true
+ description = <<-END
+ Set to `false` to disable merge commits on the repository.
+ If you set this to `false` you have to enable either `allow_squash_merge`
+ or `allow_rebase_merge`.
+ END
+ }
+
+ variable "allow_squash_merge" {
+ type = bool
+ default = false
+ description = <<-END
+ Set to `true` to enable squash merges on the repository.
+ END
+ }
+
+ variable "allow_rebase_merge" {
+ type = bool
+ default = false
+ description = <<-END
+ Set to `true` to enable rebase merges on the repository.
+ END
+ }
+
+ variable "description" {
+ type = string
+ default = ""
+ description = <<-END
+ A description of the repository.
+ END
+ }
+
+ variable "delete_branch_on_merge" {
+ type = bool
+ default = false
+ description = <<-END
+ Set to `false` to disable the automatic deletion of head branches after pull requests are merged.
+ END
+ }
+
+ variable "homepage_url" {
+ type = string
+ default = ""
+ description = <<-END
+ URL of a page describing the project.
+ END
+ }
+
+ variable "private" {
+ type = bool
+ description = <<-END
+ **_DEPRECATED_**: Please use `visibility` instead and update your code. parameter will be removed in a future version
+ END
+ }
+
+ variable "visibility" {
+ type = string
+ default = "private"
+ description = <<-END
+ 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`.
+ The `visibility` parameter overrides the deprecated `private` parameter.
+ END
+ }
+
+ variable "has_issues" {
+ type = bool
+ default = false
+ description = <<-END
+ Set to true to enable the GitHub Issues features on the repository.
+ END
+ }
+
+ variable "has_projects" {
+ type = bool
+ default = false
+ description = <<-END
+ Set to true to enable the GitHub Projects features on the repository.
+ END
+ }
+
+ variable "has_wiki" {
+ type = bool
+ default = false
+ description = <<-END
+ Set to true to enable the GitHub Wiki features on the repository.
+ END
+ }
+
+ variable "has_downloads" {
+ type = bool
+ default = false
+ description = <<-END
+ Set to `true` to enable the (deprecated) downloads features on the repository.
+ END
+ }
+
+ variable "is_template" {
+ type = bool
+ default = false
+ description = <<-END
+ Set to `true` to tell GitHub that this is a template repository.
+ END
+ }
+
+ variable "default_branch" {
+ type = string
+ default = ""
+ description = <<-END
+ The name of the default branch of the repository.
+ NOTE: This can only be set after a repository has already been created, and after a correct reference has been created for the target branch inside the repository.
+ This means a user will have to omit this parameter from the initial repository creation and create the target branch inside of the repository prior to setting this attribute.
+ END
+ }
+
+ variable "archived" {
+ type = bool
+ default = false
+ description = <<-END
+ Specifies if the repository should be archived.
+ NOTE: Currently, the API does not support unarchiving.
+ END
+ }
+
+ variable "topics" {
+ type = list(string)
+ default = []
+ description = <<-END
+ The list of topics of the repository.
+ END
+ }
+
+ variable "extra_topics" {
+ type = list(string)
+ default = []
+ description = <<-END
+ A list of additional topics of the repository. Those topics will be added to the list of `topics`. This is useful if `default.topics` are used and the list should be extended with more topics.
+ END
+ }
+
+ variable "vulnerability_alerts" {
+ type = bool
+ description = <<-END
+ Set to `false` to disable security alerts for vulnerable dependencies.
+ Enabling requires alerts to be enabled on the owner level.
+ END
+ }
+
+ variable "archive_on_destroy" {
+ type = bool
+ default = true
+ description = <<-END
+ Set to `false` to not archive the repository instead of deleting on destroy.
+ END
+ }
+ }
+
+ section {
+ title = "Extended Resource Configuration"
+
+ section {
+ title = "Repository Creation Configuration"
+ content = <<-END
+ The following four arguments can only be set at repository creation and
+ changes will be ignored for repository updates and
+ will not show a diff in plan or apply phase.
+ END
+
+ variable "auto_init" {
+ type = bool
+ default = true
+ description = <<-END
+ Set to `false` to not produce an initial commit in the repository.
+ END
+ }
+
+ variable "gitignore_template" {
+ type = string
+ default = ""
+ description = <<-END
+ Use the name of the template without the extension.
+ END
+ }
+
+ variable "license_template" {
+ type = string
+ default = ""
+ description = <<-END
+ Use the name of the template without the extension.
+ END
+ }
+
+ variable "template" {
+ type = object(template)
+ default = {}
+ description = <<-END
+ Use a template repository to create this resource.
+ END
+
+ attribute "owner" {
+ required = true
+ type = string
+ description = <<-END
+ The GitHub organization or user the template repository is owned by.
+ END
+ }
+
+ attribute "repository" {
+ required = true
+ type = string
+ description = <<-END
+ The name of the template repository.
+ END
+ }
+ }
+ }
+
+ section {
+ title = "Teams Configuration"
+ content = <<-END
+ Your can use non-computed (known at `terraform plan`) team names or slugs (`*_teams` Attributes)
+ or computed (only known in `terraform apply` phase) team IDs (`*_team_ids` Attributes).
+ **When using non-computed names/slugs teams need to exist before running plan.**
+ This is due to some terraform limitation and we will update the module once terraform removed this limitation.
+ END
+
+ variable "pull_teams" {
+ type = list(string)
+ default = []
+ description = <<-END
+ Can also be `pull_team_ids`. A list of teams to grant pull (read-only) permission.
+ Recommended for non-code contributors who want to view or discuss your project.
+ END
+ }
+
+ variable "triage_teams" {
+ type = list(string)
+ default = []
+ description = <<-END
+ Can also be `triage_team_ids`. A list of teams to grant triage permission.
+ Recommended for contributors who need to proactively manage issues and pull requests
+ without write access.
+ END
+ }
+
+ variable "push_teams" {
+ type = list(string)
+ default = []
+ description = <<-END
+ Can also be `push_team_ids`. A list of teams to grant push (read-write) permission.
+ Recommended for contributors who actively push to your project.
+ END
+ }
+
+ variable "maintain_teams" {
+ type = list(string)
+ default = []
+ description = <<-END
+ Can also be `maintain_team_ids`. A list of teams to grant maintain permission.
+ Recommended for project managers who need to manage the repository without access to sensitive or destructive actions.
+ END
+ }
+
+ variable "admin_teams" {
+ type = list(string)
+ default = []
+ description = <<-END
+ Can also be `admin_team_ids`. A list of teams to grant admin (full) permission.
+ Recommended for people who need full access to the project, including sensitive and destructive actions like managing security or deleting a repository.
+ END
+ }
+ }
+
+ section {
+ title = "Collaborator Configuration"
+
+ variable "pull_collaborators" {
+ type = list(string)
+ default = []
+ description = <<-END
+ A list of user names to add as collaborators granting them pull (read-only) permission.
+ Recommended for non-code contributors who want to view or discuss your project.
+ END
+ }
+
+ variable "triage_collaborators" {
+ type = list(string)
+ default = []
+ description = <<-END
+ A list of user names to add as collaborators granting them triage permission.
+ Recommended for contributors who need to proactively manage issues and pull requests without write access.
+ END
+ }
+
+ variable "push_collaborators" {
+ type = list(string)
+ default = []
+ description = <<-END
+ A list of user names to add as collaborators granting them push (read-write) permission.
+ Recommended for contributors who actively push to your project.
+ END
+ }
+
+ variable "maintain_collaborators" {
+ type = list(string)
+ default = []
+ description = <<-END
+ A list of user names to add as collaborators granting them maintain permission.
+ Recommended for project managers who need to manage the repository without access to sensitive or destructive actions.
+ END
+ }
+
+ variable "admin_collaborators" {
+ type = list(string)
+ default = []
+ description = <<-END
+ A list of user names to add as collaborators granting them admin (full) permission.
+ Recommended for people who need full access to the project, including sensitive and destructive actions like managing security or deleting a repository.
+ END
+ }
+ }
+
+ section {
+ title = "Deploy Keys Configuration"
+
+ variable "deploy_keys" {
+ type = list(deploy_key)
+ default = []
+ description = <<-END
+ Can also be type `string`. Specifies deploy keys and access-level of deploy keys used in this repository.
+ Every `string` in the list will be converted internally into the `object` representation with the `key` argument being set to the `string`. `object` details are explained below.
+ END
+
+ attribute "key" {
+ required = true
+ type = string
+ description = <<-END
+ The SSH public key.
+ END
+ }
+
+ attribute "title" {
+ type = string
+ description = <<-END
+ A Title for the key.
+ Default is the comment field of SSH public key if it is not empty else it defaults to `md5(key)`.
+ END
+ }
+
+ attribute "read_only" {
+ type = bool
+ default = true
+ description = <<-END
+ Specifies the level of access for the key.
+ END
+ }
+
+ attribute "id" {
+ type = string
+ default = "md5(key)"
+ description = <<-END
+ Specifies an ID which is used to prevent resource recreation when the order in the list of deploy keys changes.
+ The ID must be unique between `deploy_keys` and `deploy_keys_computed`.
+ END
+ }
+ }
+
+ variable "deploy_keys_computed" {
+ type = list(deploy_key)
+ default = []
+ description = <<-END
+ Can also be type `string`. Same as `deploy_keys` argument with the following differences:
+ Use this argument if you depend on computed keys that terraform can not use in resource `for_each` execution. Downside of this is the recreation of deploy key resources whenever the order in the list changes. **Prefer `deploy_keys` whenever possible.**
+ This argument does **not** conflict with `deploy_keys` and should exclusively be used for computed resources.
+ END
+
+ attribute "key" {
+ required = true
+ type = string
+ description = <<-END
+ The SSH public key.
+ END
+ }
+
+ attribute "title" {
+ type = string
+ description = <<-END
+ A Title for the key.
+ Default is the comment field of SSH public key if it is not empty else it defaults to `md5(key)`.
+ END
+ }
+
+ attribute "read_only" {
+ type = bool
+ default = true
+ description = <<-END
+ Specifies the level of access for the key.
+ END
+ }
+
+ attribute "id" {
+ type = string
+ default = "md5(key)"
+ description = <<-END
+ Specifies an ID which is used to prevent resource recreation when the order in the list of deploy keys changes.
+ The ID must be unique between `deploy_keys` and `deploy_keys_computed`.
+ END
+ }
+ }
+ }
+
+ section {
+ title = "Branch Protections Configuration"
+
+ variable "branch_protections_v3" {
+ type = list(branch_protection)
+ default = []
+ description = <<-END
+ This resource allows you to configure branch protection for repositories in your organization.
+ When applied, the branch will be protected from forced pushes and deletion.
+ Additional constraints, such as required status checks or restrictions on users and teams, can also be configured.
+ END
+
+ attribute "branch" {
+ required = true
+ type = string
+ description = <<-END
+ The Git branch to protect.
+ END
+ }
+
+ attribute "enforce_admins" {
+ type = bool
+ default = false
+ description = <<-END
+ Setting this to true enforces status checks for repository administrators.
+ END
+ }
+
+ attribute "require_signed_commits" {
+ type = bool
+ default = false
+ description = <<-END
+ Setting this to true requires all commits to be signed with GPG.
+ END
+ }
+
+ attribute "required_status_checks" {
+ type = object(required_status_checks)
+ default = {}
+ description = <<-END
+ Enforce restrictions for required status checks.
+ See Required Status Checks below for details.
+ END
+
+ attribute "strict" {
+ type = bool
+ default = false
+ description = <<-END
+ Require branches to be up to date before merging.
+ END
+ }
+
+ attribute "contexts" {
+ type = list(string)
+ default = []
+ description = <<-END
+ The list of status checks to require in order to merge into this branch. If default is `[]` no status checks are required.
+ END
+ }
+ }
+
+ attribute "required_pull_request_reviews" {
+ type = object(required_pull_request_reviews)
+ default = {}
+ description = <<-END
+ Enforce restrictions for pull request reviews.
+ END
+
+ attribute "dismiss_stale_reviews" {
+ type = bool
+ default = true
+ description = <<-END
+ Dismiss approved reviews automatically when a new commit is pushed.
+ END
+ }
+
+ attribute "dismissal_users" {
+ type = list(string)
+ default = []
+ description = <<-END
+ The list of user logins with dismissal access
+ END
+ }
+
+ attribute "dismissal_teams" {
+ type = list(string)
+ default = []
+ description = <<-END
+ The list of team slugs with dismissal access.
+ Always use slug of the team, not its name.
+ Each team already has to have access to the repository.
+ END
+ }
+
+ attribute "require_code_owner_reviews" {
+ type = bool
+ default = false
+ description = <<-END
+ Require an approved review in pull requests including files with a designated code owner.
+ END
+ }
+ }
+
+ attribute "restrictions" {
+ type = object(restrictions)
+ default = {}
+ description = <<-END
+ Enforce restrictions for the users and teams that may push to the branch - only available for organization-owned repositories. See Restrictions below for details.
+ END
+
+ attribute "users" {
+ type = list(string)
+ default = []
+ description = <<-END
+ The list of user logins with push access.
+ END
+ }
+
+ attribute "teams" {
+ type = list(string)
+ default = []
+ description = <<-END
+ The list of team slugs with push access.
+ Always use slug of the team, not its name.
+ Each team already has to have access to the repository.
+ END
+ }
+
+ attribute "apps" {
+ type = list(string)
+ default = []
+ description = <<-END
+ The list of app slugs with push access.
+ END
+ }
+ }
+ }
+
+ variable "branch_protections" {
+ type = list(branch_protection)
+ default = []
+ description = <<-END
+ **_DEPRECATED_** To ensure compatibility with future versions of this module, please use `branch_protections_v3`.
+ This argument is ignored if `branch_protections_v3` is used.
+ END
+
+ attribute "branch" {
+ required = true
+ type = string
+ description = <<-END
+ The Git branch to protect.
+ END
+ }
+
+ attribute "enforce_admins" {
+ type = bool
+ default = false
+ description = <<-END
+ Setting this to true enforces status checks for repository administrators.
+ END
+ }
+
+ attribute "require_signed_commits" {
+ type = bool
+ default = false
+ description = <<-END
+ Setting this to true requires all commits to be signed with GPG.
+ END
+ }
+
+ attribute "required_status_checks" {
+ type = object(required_status_checks)
+ default = {}
+ description = <<-END
+ Enforce restrictions for required status checks.
+ See Required Status Checks below for details.
+ END
+
+ attribute "strict" {
+ type = bool
+ description = <<-END
+ Require branches to be up to date before merging.
+ Defaults is `false`.
+ END
+ }
+
+ attribute "contexts" {
+ type = list(string)
+ default = []
+ description = <<-END
+ The list of status checks to require in order to merge into this branch. If default is `[]` no status checks are required.
+ END
+ }
+ }
+
+ attribute "required_pull_request_reviews" {
+ type = object(required_pull_request_reviews)
+ default = {}
+ description = <<-END
+ Enforce restrictions for pull request reviews.
+ END
+
+ attribute "dismiss_stale_reviews" {
+ type = bool
+ default = true
+ description = <<-END
+ Dismiss approved reviews automatically when a new commit is pushed.
+ END
+ }
+
+ attribute "dismissal_users" {
+ type = list(string)
+ default = []
+ description = <<-END
+ The list of user logins with dismissal access
+ END
+ }
+
+ attribute "dismissal_teams" {
+ type = list(string)
+ default = []
+ description = <<-END
+ The list of team slugs with dismissal access.
+ Always use slug of the team, not its name.
+ Each team already has to have access to the repository.
+ END
+ }
+
+ attribute "require_code_owner_reviews" {
+ type = bool
+ default = false
+ description = <<-END
+ Require an approved review in pull requests including files with a designated code owner.
+ END
+ }
+ }
+
+ attribute "restrictions" {
+ type = object(restrictions)
+ default = {}
+ description = <<-END
+ Enforce restrictions for the users and teams that may push to the branch - only available for organization-owned repositories. See Restrictions below for details.
+ END
+
+ attribute "users" {
+ type = list(string)
+ default = []
+ description = <<-END
+ The list of user logins with push access.
+ END
+ }
+
+ attribute "teams" {
+ type = list(string)
+ default = []
+ description = <<-END
+ The list of team slugs with push access.
+ Always use slug of the team, not its name.
+ Each team already has to have access to the repository.
+ END
+ }
+
+ attribute "apps" {
+ type = list(string)
+ default = []
+ description = <<-END
+ The list of app slugs with push access.
+ END
+ }
+ }
+ }
+ }
+
+ section {
+ title = "Issue Labels Configuration"
+
+ variable "issue_labels" {
+ type = list(issue_label)
+ default = []
+ description = <<-END
+ This resource allows you to create and manage issue labels within your GitHub organization.
+ Issue labels are keyed off of their "name", so pre-existing issue labels result in a 422 HTTP error if they exist outside of Terraform.
+ Normally this would not be an issue, except new repositories are created with a "default" set of labels, and those labels easily conflict with custom ones.
+ This resource will first check if the label exists, and then issue an update, otherwise it will create.
+ END
+
+ attribute "name" {
+ required = true
+ type = string
+ description = <<-END
+ The name of the label.
+ END
+ }
+
+ attribute "color" {
+ required = true
+ type = string
+ description = <<-END
+ A 6 character hex code, without the leading `#`, identifying the color of the label.
+ END
+ }
+
+ attribute "description" {
+ type = string
+ default = ""
+ description = <<-END
+ A short description of the label.
+ END
+ }
+
+ attribute "id" {
+ type = string
+ default = "name"
+ description = <<-END
+ Specifies an ID which is used to prevent resource recreation when the order in the list of issue labels changes.
+ END
+ }
+ }
+
+ variable "issue_labels_merge_with_github_labels" {
+ type = bool
+ description = <<-END
+ Specify if github default labels will be handled by terraform. This should be decided on upon creation of the repository. If you later decide to disable this feature, github default labels will be destroyed if not replaced by labels set in `issue_labels` argument.
+ END
+ }
+
+ variable "issue_labels_create" {
+ type = bool
+ description = <<-END
+ Specify whether you want to force or suppress the creation of issues labels.
+ Default is `true` if `has_issues` is `true` or `issue_labels` is non-empty.
+ END
+ }
+ }
+
+ section {
+ title = "Projects Configuration"
+
+ variable "projects" {
+ type = list(project)
+ default = []
+ description = <<-END
+ This resource allows you to create and manage projects for GitHub repository.
+ END
+
+ attribute "name" {
+ required = true
+ type = string
+ description = <<-END
+ The name of the project.
+ END
+ }
+
+ attribute "body" {
+ type = string
+ default = ""
+ description = <<-END
+ The body of the project.
+ END
+ }
+
+ attribute "id" {
+ type = string
+ default = "name"
+ description = <<-END
+ Specifies an ID which is used to prevent resource recreation when the order in the list of projects changes.
+ END
+ }
+ }
+ }
+
+ section {
+ title = "Webhooks Configuration"
+
+ variable "webhooks" {
+ type = list(webhook)
+ default = []
+ description = <<-END
+ This resource allows you to create and manage webhooks for repositories in your organization.
+ When applied, a webhook will be created which specifies a URL to receive events and which events to receieve. Additional constraints, such as SSL verification, pre-shared secret and content type can also be configured
+ END
+
+ attribute "events" {
+ required = true
+ type = list(string)
+ description = <<-END
+ A list of events which should trigger the webhook. [See a list of available events.](https://developer.github.com/v3/activity/events/types/)
+ END
+ }
+
+ attribute "url" {
+ required = true
+ type = string
+ description = <<-END
+ The URL to which the payloads will be delivered.
+ END
+ }
+
+ attribute "active" {
+ type = bool
+ description = <<-END
+ Indicate if the webhook should receive events. Defaults to `true`.
+ END
+ }
+
+ attribute "content_type" {
+ type = string
+ default = "form"
+ description = <<-END
+ The media type used to serialize the payloads. Supported values include `json` and `form`.
+ END
+ }
+
+ attribute "secret" {
+ type = string
+ description = <<-END
+ If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value in the [X-Hub-Signature](https://developer.github.com/webhooks/#delivery-headers) header.
+ END
+ }
+
+ attribute "insecure_ssl" {
+ type = bool
+ description = <<-END
+ Determines whether the SSL certificate of the host for `url` will be verified when delivering payloads. Supported values include `0` (verification is performed) and `1` (verification is not performed). The default is `0`. **We strongly recommend not setting this to `1` as you are subject to man-in-the-middle and other attacks.**
+ END
+ }
+ }
+ }
+
+ section {
+ title = "Secrets Configuration"
+
+ variable "plaintext_secrets" {
+ type = map(string)
+ default = {}
+ description = <<-END
+ This map allows you to create and manage secrets for repositories in your organization.
+ Each element in the map is considered a secret to be managed, being the key map the secret name and the value the corresponding secret in plain text:
+
+ ```
+ plaintext_secrets = {
+ SECRET_NAME_1 = "secret_value_1"
+ SECRET_NAME_2 = "secret_value_2"
+ ...
+ }
+ ```
+
+ When applied, a secret with the given key and value will be created in the repositories.
+ The value of the secrets must be given in plain text, github provider is in charge of encrypting it.
+ **Attention:** You might want to get secrets via a data source from a secure vault and not add them in plain text to your source files; so you do not commit plaintext secrets into the git repository managing your github account.
+ END
+ }
+
+ variable "required_approving_review_count" {
+ type = number
+ description = <<-END
+ Require x number of approvals to satisfy branch protection requirements.
+ If this is specified it must be a number between 1-6.
+ This requirement matches Github's API, see the upstream documentation for more information.
+ Default is no approving reviews are required.
+ END
+ }
+ }
+ }
+
+ section {
+ title = "Module Configuration"
+
+ variable "module_depends_on" {
+ type = list(any)
+ default = []
+ description = <<-END
+ Due to the fact, that terraform does not offer `depends_on` on modules as of today (v0.12.24)
+ we might hit race conditions when dealing with team names instead of ids.
+ So when using the feature of [adding teams by slug/name](#teams-configuration) to the repository when creating it,
+ make sure to add all teams to this list as indirect dependencies.
+ END
+ }
+ }
+ }
+
+ section {
+ title = "Module Outputs"
+ content = <<-END
+ The following attributes are exported by the module:
+
+ - **`repository`**
+
+ All repository attributes as returned by the [`github_repository`] resource containing all arguments as specified above and the other attributes as specified below.
+
+ - **`full_name`**
+
+ A string of the form "orgname/reponame".
+
+ - **`html_url`**
+
+ URL to the repository on the web.
+
+ - **`ssh_clone_url`**
+
+ URL that can be provided to git clone to clone the repository via SSH.
+
+ - **`http_clone_url`**
+
+ URL that can be provided to git clone to clone the repository via HTTPS.
+
+ - **`git_clone_url`**
+
+ URL that can be provided to git clone to clone the repository anonymously via the git protocol.
+
+ - **`collaborators`**
+
+ A map of Collaborator objects keyed by the `name` of the collaborator as returned by the
+ [`github_repository_collaborator`] resource.
+
+ - **`deploy_keys`**
+
+ A merged map of deploy key objects for the keys originally passed via `deploy_keys` and `deploy_keys_computed` as returned by the [`github_repository_deploy_key`] resource keyed by the input `id` of the key.
+
+ - **`projects`**
+
+ A map of Project objects keyed by the `id` of the project as returned by the [`github_repository_project`] resource
+
+ - **`issue_labels`**
+
+ A map of issue labels keyed by label input id or name.
+
+ - **`webhooks`**
+
+ All attributes and arguments as returned by the github_repository_webhook resource.
+
+ - **`secrets`**
+
+ List of secrets available.
+ END
+ }
+
+ section {
+ title = "External Documentation"
+
+ section {
+ title = "Terraform Github Provider Documentation"
+ content = <<-END
+ - https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository
+ - https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_collaborator
+ - https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_deploy_key
+ - https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_project
+ END
+ }
+ }
+
+ section {
+ title = "Module Versioning"
+ content = <<-END
+ This Module follows the principles of [Semantic Versioning (SemVer)].
+
+ Given a version number `MAJOR.MINOR.PATCH`, we increment the:
+
+ 1. `MAJOR` version when we make incompatible changes,
+ 2. `MINOR` version when we add functionality in a backwards compatible manner, and
+ 3. `PATCH` version when we make backwards compatible bug fixes.
+ END
+
+ section {
+ title = "Backwards compatibility in `0.0.z` and `0.y.z` version"
+ content = <<-END
+ - Backwards compatibility in versions `0.0.z` is **not guaranteed** when `z` is increased. (Initial development)
+ - Backwards compatibility in versions `0.y.z` is **not guaranteed** when `y` is increased. (Pre-release)
+ END
+ }
+ }
+
+ section {
+ title = "About Mineiros"
+ content = <<-END
+ [Mineiros][homepage] is a remote-first company headquartered in Berlin, Germany
+ that solves development, automation and security challenges in cloud infrastructure.
+
+ Our vision is to massively reduce time and overhead for teams to manage and
+ deploy production-grade and secure cloud infrastructure.
+
+ We offer commercial support for all of our modules and encourage you to reach out
+ if you have any questions or need help. Feel free to email us at [hello@mineiros.io] or join our
+ [Community Slack channel][slack].
+ END
+ }
+
+ section {
+ title = "Reporting Issues"
+ content = <<-END
+ We use GitHub [Issues] to track community reported issues and missing features.
+ END
+ }
+
+ section {
+ title = "Contributing"
+ content = <<-END
+ Contributions are always encouraged and welcome! For the process of accepting changes, we use
+ [Pull Requests]. If you'd like more information, please see our [Contribution Guidelines].
+ END
+ }
+
+ section {
+ title = "Makefile Targets"
+ content = <<-END
+ This repository comes with a handy [Makefile].
+ Run `make help` to see details on each available target.
+ END
+ }
+
+ section {
+ title = "License"
+ content = <<-END
+ [![license][badge-license]][apache20]
+
+ This module is licensed under the Apache License Version 2.0, January 2004.
+ Please see [LICENSE] for full details.
+
+ Copyright © 2020-2022 [Mineiros GmbH][homepage]
+ END
+ }
+}
+
+references {
+ ref "github" {
+ value = "https://github.com/"
+ }
+ ref "`github_repository`" {
+ value = "https://www.terraform.io/docs/providers/github/r/repository.html#attributes-reference"
+ }
+ ref "`github_repository_collaborator`" {
+ value = "https://www.terraform.io/docs/providers/github/r/repository_collaborator.html#attribute-reference"
+ }
+ ref "`github_repository_deploy_key`" {
+ value = "https://www.terraform.io/docs/providers/github/r/repository_deploy_key.html#attributes-reference"
+ }
+ ref "`github_repository_project`" {
+ value = "https://www.terraform.io/docs/providers/github/r/repository_project.html#attributes-reference"
+ }
+ ref "homepage" {
+ value = "https://mineiros.io/?ref=terraform-github-repository"
+ }
+ ref "hello@mineiros.io" {
+ value = "mailto:hello@mineiros.io"
+ }
+ ref "badge-build" {
+ value = "https://github.com/mineiros-io/terraform-github-repository/workflows/CI/CD%20Pipeline/badge.svg"
+ }
+ ref "badge-semver" {
+ value = "https://img.shields.io/github/v/tag/mineiros-io/terraform-github-repository.svg?label=latest&sort=semver"
+ }
+ ref "badge-license" {
+ value = "https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg"
+ }
+ ref "badge-terraform" {
+ value = "https://img.shields.io/badge/terraform-1.x-623CE4.svg?logo=terraform"
+ }
+ ref "badge-slack" {
+ value = "https://img.shields.io/badge/slack-@mineiros--community-f32752.svg?logo=slack"
+ }
+ ref "badge-tf-gh" {
+ value = "https://img.shields.io/badge/GH-4.10+-F8991D.svg?logo=terraform"
+ }
+ ref "releases-github-provider" {
+ value = "https://github.com/terraform-providers/terraform-provider-github/releases"
+ }
+ ref "build-status" {
+ value = "https://github.com/mineiros-io/terraform-github-repository/actions"
+ }
+ ref "releases-github" {
+ value = "https://github.com/mineiros-io/terraform-github-repository/releases"
+ }
+ ref "releases-terraform" {
+ value = "https://github.com/hashicorp/terraform/releases"
+ }
+ ref "apache20" {
+ value = "https://opensource.org/licenses/Apache-2.0"
+ }
+ ref "slack" {
+ value = "https://join.slack.com/t/mineiros-community/shared_invite/zt-ehidestg-aLGoIENLVs6tvwJ11w9WGg"
+ }
+ ref "terraform" {
+ value = "https://www.terraform.io"
+ }
+ ref "aws" {
+ value = "https://aws.amazon.com/"
+ }
+ ref "semantic versioning (semver)" {
+ value = "https://semver.org/"
+ }
+ ref "variables.tf" {
+ value = "https://github.com/mineiros-io/terraform-github-repository/blob/main/variables.tf"
+ }
+ ref "examples/" {
+ value = "https://github.com/mineiros-io/terraform-github-repository/blob/main/examples"
+ }
+ ref "issues" {
+ value = "https://github.com/mineiros-io/terraform-github-repository/issues"
+ }
+ ref "license" {
+ value = "https://github.com/mineiros-io/terraform-github-repository/blob/main/LICENSE"
+ }
+ ref "makefile" {
+ value = "https://github.com/mineiros-io/terraform-github-repository/blob/main/Makefile"
+ }
+ ref "pull requests" {
+ value = "https://github.com/mineiros-io/terraform-github-repository/pulls"
+ }
+ ref "contribution guidelines" {
+ value = "https://github.com/mineiros-io/terraform-github-repository/blob/main/CONTRIBUTING.md"
+ }
+}