mineiros-io / terraform-github-repository

A Terraform module to manage GitHub Repositories. https://github.com/
Apache License 2.0
156 stars 100 forks source link
github github-repository iac mineiros terraform terraform-github terraform-modules

Build Status GitHub tag (latest SemVer) Terraform Version Github Provider Version Join Slack

terraform-github-repository

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.20 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

Note: Versions 5.3.0, 5.4.0, and 5.5.0 of the Terraform Github Provider have broken branch protections support and should not be used.

GitHub as Code

GitHub as Code is a commercial solution built on top of our open-source Terraform modules for GitHub. It helps our customers to manage their GitHub organization more efficiently by enabling anyone in their organization to self-service manage on- and offboarding of users, repositories, and settings such as branch protections, secrets, and more through code. GitHub as Code comes with pre-configured GitHub Actions pipelines for change pre-view in Pull Requests, fully automated rollouts and rollbacks. It's a comprehensive, ready-to-use blueprint maintained by our team of platform engineering experts and saves companies such as yours tons of time by building on top of a pre-configured solution instead of building and maintaining it yourself.

For details please see https://mineiros.io/github-as-code.

Module Features

In contrast to the plain github_repository resource this module enables various other features like Branch Protection or Collaborator Management.

Getting Started

Most basic usage creating a new private github repository.

module "repository" {
  source  = "mineiros-io/repository/github"
  version = "~> 0.18.0"

  name               = "terraform-github-repository"
  license_template   = "apache-2.0"
  gitignore_template = "Terraform"
}

Module Argument Reference

See variables.tf and examples/ for details and use-cases.

Main Resource Configuration

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.

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). 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.

Collaborator Configuration

Branches Configuration

Deploy Keys Configuration

Branch Protections v3 Configuration

Branch Protections v4 Configuration

Issue Labels Configuration

Projects Configuration

Webhooks Configuration

Secrets Configuration

Autolink References Configuration

App Installations

Module Configuration

Module Outputs

The following attributes are exported by the module:

External Documentation

Terraform Github Provider Documentation

Module Versioning

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.

Backwards compatibility in 0.0.z and 0.y.z version

About Mineiros

Mineiros 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.

Reporting Issues

We use GitHub Issues to track community reported issues and missing features.

Contributing

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.

Makefile Targets

This repository comes with a handy Makefile. Run make help to see details on each available target.

License

license

This module is licensed under the Apache License Version 2.0, January 2004. Please see LICENSE for full details.

Copyright © 2020-2022 Mineiros GmbH