Skip to content

Commit

Permalink
Merge pull request #19 from mineiros-io/clean-up-terraform-github-tea…
Browse files Browse the repository at this point in the history
…m-module

Clean up terraform GitHub team module
  • Loading branch information
soerenmartius authored Jun 25, 2020
2 parents e5c9009 + 8ab1bef commit 61eceb9
Show file tree
Hide file tree
Showing 20 changed files with 502 additions and 271 deletions.
80 changes: 48 additions & 32 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,92 @@
# Contribution Guidelines

First and foremost, we’d like to express our gratitude to you for taking the time to contribute.
We welcome and appreciate any and all contributions via
[Pull Requests](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)
along the [GitHub Flow](https://guides.github.com/introduction/flow/).
First and foremost, we’d like to express our gratitude to you for taking the time to contribute.
We welcome and appreciate any and all contributions via
[Pull Requests] along the [GitHub Flow].

1. [Open a GitHub issue](#open-a-github-issue)
1. [Fork the repository on GitHub](#fork-the-repository-on-github)
1. [Install the pre-commit hooks](#install-the-pre-commit-hooks)
1. [Update the documentation](#update-the-documentation)
1. [Update the tests](#update-the-tests)
1. [Update the code](#update-the-code)
1. [Create a pull request](#create-a-pull-request)
1. [Merge and release](#merge-and-release)
2. [Fork the repository on GitHub](#fork-the-repository-on-github)
3. [Install the pre-commit hooks](#install-the-pre-commit-hooks)
4. [Update the documentation](#update-the-documentation)
5. [Update the tests](#update-the-tests)
6. [Update the code](#update-the-code)
7. [Create a pull request](#create-a-pull-request)
8. [Merge and release](#merge-and-release)

## Open a GitHub issue

For bug reports or requests, please submit your issue in the appropriate repository.

We advise that you open an issue and ask the
[CODEOWNERS](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners) and
community prior to starting a contribution. This is your chance to ask questions and receive feedback before you start
writing ( potentially wrong ) code. We value the direct contact to our community a lot, so don't hesitate to ask any
questions.
[CODEOWNERS] and community prior to starting a contribution.
This is your chance to ask questions and receive feedback before
writing (potentially wrong) code. We value the direct contact with our community
a lot, so don't hesitate to ask any questions.

## Fork the repository on GitHub

[Fork](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) the repository into your own GitHub
account and [create a new branch](https://guides.github.com/introduction/flow/) as described in the
[GitHub Flow](https://guides.github.com/introduction/flow/).
[Fork] the repository into your own GitHub account and [create a new branch] as
described in the [GitHub Flow].

## Install the pre-commit hooks

If the repository you're working on ships with a `.pre-commit-config.yaml,` make sure the necessary hooks have been
installed before you begin working (e.g. a `pre-commit install`).
If the repository you're working on ships with a
[`.pre-commit-config.yaml`][pre-commit-file],
make sure the necessary hooks have been installed before you begin working
(e.g. a `pre-commit install`).

## Update the documentation

We encourage you to update the documentation before writing any code (please see
[Readme Driven Development](https://tom.preston-werner.com/2010/08/23/readme-driven-development.html). This ensures the
[Readme Driven Development]. This ensures the
documentation stays up to date and allows you to think through the problem fully before you begin implementing any
changes.

## Update the tests

We also recommend updating the automated tests before updating any code
(see [Test Driven Development](https://en.wikipedia.org/wiki/Test-driven_development)).
(see [Test Driven Development].

That means that you should add or update a test case, run all tests and verify that the new test fails with a clear
error message and then start implementing the code changes to get that test to pass.
That means that you should add or update a test case, run all tests and verify
that the new test fails with a clear error message and then start implementing
the code changes to get that test to pass.

The test folder in every repository will have documentation on how to run the tests locally.
The test folder in every repository will have documentation on how to run the
tests locally.

## Update the code

At this point, make your code changes and constantly test again your new test case to make sure that everything working
properly. Do [commit](https://help.github.com/en/desktop/contributing-to-projects/committing-and-reviewing-changes-to-your-project)
early and often and make useful commit messages.
properly. Do [commit] early and often and make useful commit messages.

If a backwards incompatible change cannot be avoided, please make sure to call that out when you submit a pull request,
explaining why the change is absolutely necessary.
explaining why the change is absolutely necessary.

## Create a pull request

[Create a pull request](https://help.github.com/articles/creating-a-pull-request/) with your changes.
[Create a pull request] with your changes.
Please make sure to include the following:

1. A description of the change, including a link to your GitHub issue.
1. Any notes on backwards incompatibility or downtime.

## Merge and release

The [CODEOWNERS](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners)
of the repository will review your code and provide feedback. If everything looks good, they will merge the code and
release a new version while following the principles of [Semantic Versioning (SemVer)](https://semver.org/).
The [CODEOWNERS] of the repository will review your code and provide feedback.
If everything looks good, they will merge the code and release a new version while following
the principles of [Semantic Versioning (SemVer)].

<!-- References -->

[Pull Requests]: https://github.com/mineiros-io/terraform-github-team/pulls
[pre-commit-file]: https://github.com/mineiros-io/terraform-github-team/blob/master/.pre-commit-config.yaml

[Github Flow]: https://guides.github.com/introduction/flow/
[CODEOWNERS]: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
[Fork]: https://help.github.com/en/github/getting-started-with-github/fork-a-repo
[create a new branch]: https://guides.github.com/introduction/flow/
[Readme Driven Development]: https://tom.preston-werner.com/2010/08/23/readme-driven-development.html
[commit]: https://help.github.com/en/desktop/contributing-to-projects/committing-and-reviewing-changes-to-your-project
[create a pull request]: https://help.github.com/articles/creating-a-pull-request/
[Semantic Versioning (SemVer)]: https://semver.org/
[Test Driven Development]: https://en.wikipedia.org/wiki/Test-driven_development
195 changes: 137 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
[<img src="https://raw.githubusercontent.com/mineiros-io/brand/3bffd30e8bdbbde32c143e2650b2faa55f1df3ea/mineiros-primary-logo.svg" width="400"/>](https://www.mineiros.io/?ref=terraform-github-team)
[<img src="https://raw.githubusercontent.com/mineiros-io/brand/3bffd30e8bdbbde32c143e2650b2faa55f1df3ea/mineiros-primary-logo.svg" width="400"/>][homepage]

[![Build Status](https://mineiros.semaphoreci.com/badges/terraform-github-team/branches/master.svg?style=shields)](https://mineiros.semaphoreci.com/projects/terraform-github-team)
[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/mineiros-io/terraform-github-team.svg?label=latest&sort=semver)](https://github.com/mineiros-io/terraform-github-team/releases)
[![license](https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg)](https://opensource.org/licenses/Apache-2.0)
[![Terraform Version](https://img.shields.io/badge/terraform-~%3E%200.12.20-623CE4.svg)](https://github.com/hashicorp/terraform/releases)
[<img src="https://img.shields.io/badge/[email protected]?logo=slack">](https://join.slack.com/t/mineiros-community/shared_invite/zt-ehidestg-aLGoIENLVs6tvwJ11w9WGg)
[![Build Status][badge-build]][build-status]
[![GitHub tag (latest SemVer)][badge-semver]][releases-github]
[![license][badge-license]][apache20]
[![Terraform Version][badge-terraform]][releases-terraform]
[![Join Slack][badge-slack]][slack]

# terraform-github-team

A [Terraform](https://www.terraform.io) 0.12 that offers a more convenient and tested way to provision and manage
[GitHub teams](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/organizing-members-into-teams).

> This Module uses `for, for-each and dynamic nested blocks` that were introduced in Terraform 0.12.
> A common problem in Terraform configurations for versions 0.11 and earlier is dealing with situations where the number
> of values or resources is decided by a dynamic expression rather than a fixed count.
> You can now dynamically add and remove items from and to Lists without the necessity to render the whole list of
> resources again. Terraform will only add and remove the items you want it to.
A [Terraform] 0.12 module that offers a more convenient and tested way to provision and manage [GitHub teams].

- [Features](#features)
- [Getting Started](#getting-started)
- [Examples](#examples)
- [Makefile Targets](#makefile-targets)
- [Tests](#tests)
- [Module Argument Reference](#module-argument-reference)
- [Top-level Arguments](#top-level-arguments)
- [Module Configuration](#module-configuration)
- [Main Resource Configuration](#main-resource-configuration)
- [Module Attributes Reference](#module-attributes-reference)
- [External Documentation](#external-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)
- [Reporting Issues](#reporting-issues)
- [Contributing](#contributing)
- [Makefile Targets](#makefile-targets)
- [License](#license)

## Features
Expand Down Expand Up @@ -71,79 +69,160 @@ resource "github_repository" "repository" {

## Examples

For a complete example please see [examples](https://github.com/mineiros-io/terraform-github-team/tree/master/examples) directory.
For a complete example please see [examples/] directory.

## Makefile Targets
## Module Argument Reference

This repository comes with a handy
[Makefile](https://github.com/mineiros-io/terraform-github-team/blob/master/Makefile).
Run `make help` to see details on each available target.
See [variables.tf] and [examples/] for details and use-cases.

## Tests
### Top-level Arguments

This modules ships with a [Makefile](https://github.com/mineiros-io/terraform-github-team/blob/master/Makefile)
that offers targets to execute the hooks and tests.
#### Module Configuration

**Execute all pre-commit hooks with Docker:**
- **`module_depends_on`**: *(Optional `list(any)`)*

```bash
make docker/pre-commit-hooks
```
A list of dependencies. Any object can be _assigned_ to this list to define a hidden external dependency.

**Execute the Unit Test (deploy und undeploy the example):**
#### Main Resource Configuration

Please be aware, that in order to run the test you must provide GitHub credentials and an organization.
Running the tests will create and destroy real resources.
- **`name`**: **(Required `string`)**

```bash
GITHUB_ORGANIZATION=YOUR_GITHUB_ORGANIZATION \
GITHUB_TOKEN=YOUR_GITHUB_TOKEN \
make docker/unit-tests
```
The name of the team.

- **`push_repositories`**: *(Optional `set(string)`)*

A list of repository names the current team should get push (read-write) permission to.
Default is `[]`.

- **`pull_repositories`**: *(Optional `set(string)`)*

A list of repository names the current team should get pull (read-only) permission to.
Default is `[]`.

- **`maintainers`**: *(Optional `set(string)`)*

A list of users that will be added to the current team with maintainer permissions.
Default is `[]`.

- **`members`**: *(Optional `set(string)`)*

A list of users that will be added to the current team with member permissions.
Default is `[]`.

- **`admin_repositories`**: *(Optional `set(string)`)*

A list of repository names the current team should get admin (full) permission to.
Default is `[]`.

- **`description`**: *(Optional `string`)*

A description of the team.
Default is `""`.

- **`privacy`**: *(Optional `string`)*

The level of privacy for the team. Must be one of `secret` or `closed`.
Default is `"secret"`.

- **`parent_team_id`**: *(Optional `number`)*

The ID of the parent team, if this is a nested team.
Default is to create a root team without a parent.

- **`ldap_dn`**: *(Optional `string`)*

The LDAP Distinguished Name of the group where membership will be synchronized. Only available in GitHub Enterprise.
Default is `null`.

## Module Attributes Reference

The following attributes are exported by the module:

- **`module_depends_on`**

A list of external resources the module depends_on.

## External Documentation

- GitHub Provider Documentation
- https://www.terraform.io/docs/providers/github/index.html

## Module Versioning

This Module follows the principles of [Semantic Versioning (SemVer)](https://semver.org/).
This Module follows the principles of [Semantic Versioning (SemVer)].

Using the given version number of `MAJOR.MINOR.PATCH`, we apply the following constructs:
Given a version number `MAJOR.MINOR.PATCH`, we increment the:

1. Use the `MAJOR` version for incompatible changes.
1. Use the `MINOR` version when adding functionality in a backwards compatible manner.
1. Use the `PATCH` version when introducing backwards compatible bug fixes.
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

- In the context of initial development, backwards compatibility in versions `0.0.z` is **not guaranteed** when `z` is
increased. (Initial development)
- In the context of pre-release, backwards compatibility in versions `0.y.z` is **not guaranteed** when `y` is
increased. (Pre-release)
- 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)

## About Mineiros

Mineiros is a [DevOps as a Service](https://www.mineiros.io/?ref=terraform-github-team) 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 [[email protected]](mailto:[email protected]).
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 [[email protected]]
or join our [Community Slack channel][slack].

We can also help you with:

- Terraform Modules for all types of infrastructure such as VPC's, Docker clusters,
databases, logging and monitoring, CI, etc.
- Consulting & Training on AWS, Terraform and DevOps.
- 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

## Reporting Issues

We use GitHub [Issues](https://github.com/mineiros-io/terraform-github-team/issues)
to track community reported issues and missing features.
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](https://github.com/mineiros-io/terraform-github-team/pulls). If you’d like more information, please
see our [Contribution Guidelines](https://github.com/mineiros-io/terraform-github-team/blob/master/CONTRIBUTING.md).
Contributions are 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

This module is licensed under the Apache License Version 2.0, January 2004.
Please see [LICENSE](https://github.com/mineiros-io/terraform-github-team/blob/master/LICENSE) for full details.
Please see [LICENSE] for full details.

Copyright &copy; 2020 [Mineiros GmbH][homepage]

<!-- References -->

[homepage]: https://mineiros.io/?ref=terraform-github-team
[[email protected]]: mailto:[email protected]

[badge-build]: https://mineiros.semaphoreci.com/badges/terraform-github-team/branches/master.svg?style=shields
[badge-semver]: https://img.shields.io/github/v/tag/mineiros-io/terraform-github-team.svg?label=latest&sort=semver
[badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg
[badge-terraform]: https://img.shields.io/badge/terraform-0.13%20and%200.12.20+-623CE4.svg?logo=terraform
[badge-slack]: https://img.shields.io/badge/[email protected]?logo=slack

[build-status]: https://mineiros.semaphoreci.com/projects/terraform-github-team
[releases-github]: https://github.com/mineiros-io/terraform-github-team/releases

[releases-terraform]: https://github.com/hashicorp/terraform/releases
[apache20]: https://opensource.org/licenses/Apache-2.0
[slack]: https://join.slack.com/t/mineiros-community/shared_invite/zt-ehidestg-aLGoIENLVs6tvwJ11w9WGg
[Terraform]: https://www.terraform.io
[AWS]: https://aws.amazon.com/
[Semantic Versioning (SemVer)]: https://semver.org/

[Github teams](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/organizing-members-into-teams)

Copyright &copy; 2020 Mineiros GmbH
[variables.tf]: https://github.com/mineiros-io/terraform-github-team/blob/master/variables.tf
[examples/]: https://github.com/mineiros-io/terraform-github-team/tree/master/examples
[Issues]: https://github.com/mineiros-io/terraform-github-team/issues
[LICENSE]: https://github.com/mineiros-io/terraform-github-team/blob/master/LICENSE
[Makefile]: https://github.com/mineiros-io/terraform-github-team/blob/master/Makefile
[Pull Requests]: https://github.com/mineiros-io/terraform-github-team/pulls
[Contribution Guidelines]: https://github.com/mineiros-io/terraform-github-team/blob/master/CONTRIBUTING.md
Loading

0 comments on commit 61eceb9

Please sign in to comment.