Skip to content

Commit

Permalink
Align README.md and variables.tf with latest standard
Browse files Browse the repository at this point in the history
  • Loading branch information
soerenmartius committed Jun 25, 2020
1 parent 7f01df1 commit 8ab1bef
Show file tree
Hide file tree
Showing 15 changed files with 225 additions and 243 deletions.
36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,23 @@

# terraform-github-team

A [Terraform] ~> 0.12 module that offers a more convenient and tested way to provision and manage [GitHub teams].
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 @@ -74,63 +79,68 @@ See [variables.tf] and [examples/] for details and use-cases.

#### Module Configuration

- **`module_enabled`**: *(Optional `bool`)*

Specifies whether resources in the module will be created.
Default is `true`.

- **`module_depends_on`**: *(Optional `list(any)`)*

A list of dependencies. Any object can be _assigned_ to this list to define a hidden external dependency.

#### Main Resource Configuration

- **`name`**: *(Required `string`)*
- **`name`**: **(Required `string`)**

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 `""`.
Default is `"secret"`.

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

The ID of the parent team, if this is a nested team.
Default is `null`.
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_enabled`**
- **`module_depends_on`**

Whether this module is enabled.
A list of external resources the module depends_on.

## External Documentation

Expand Down
28 changes: 28 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[<img src="https://raw.githubusercontent.com/mineiros-io/brand/3bffd30e8bdbbde32c143e2650b2faa55f1df3ea/mineiros-primary-logo.svg" width="400"/>][homepage]

[![GitHub tag (latest SemVer)][badge-semver]][releases-github]
[![license][badge-license]][apache20]
[![Terraform Version][badge-terraform]][releases-terraform]
[![Join Slack][badge-slack]][slack]

# Examples for using this Mineiros module

- [github-team/] Create a team with two repositories with different permissions.

<!-- References -->

<!-- markdown-link-check-disable -->
[github-team/]: https://github.com/mineiros-io/terraform-github-team/blob/master/examples/github-team
<!-- markdown-link-check-enable -->

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

[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
[badge-semver]: https://img.shields.io/github/v/tag/mineiros-io/terraform-github-team.svg?label=latest&sort=semver

[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
89 changes: 89 additions & 0 deletions examples/github-team/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
[<img src="https://raw.githubusercontent.com/mineiros-io/brand/3bffd30e8bdbbde32c143e2650b2faa55f1df3ea/mineiros-primary-logo.svg" width="400"/>][homepage]

[![license][badge-license]][apache20]
[![Terraform Version][badge-terraform]][releases-terraform]
[![Join Slack][badge-slack]][slack]

# Create a team which has access to two newly created repositories

This example shows how to create a team and two repositories.
The team will have pull permissions for one repository and push permissions
for the other. We also add lists of members and maintainers to the team.

## Basic usage

The code in [main.tf] defines two public GitHub repository and two nested
GitHub teams. The team will be granted pull permissions to the one repository
and push permissions to the other.

```hcl
module "team" {
source = "mineiros-io/team/github"
version = "0.1.3"
name = "Engineering"
description = "This team is created with terraform to test the terraformn-github-repository module."
privacy = "closed"
members = ["alice"]
maintainers = ["bob"]
pull_repositories = [
github_repository.repository.name,
]
push_repositories = [
github_repository.another_repository.name,
]
}
module "child_team" {
source = "mineiros-io/team/github"
version = "0.1.3"
name = "DevOps"
parent_team_id = module.team.id
privacy = "closed"
}
```

## Running the example

### Cloning the repository

```bash
git clone https://github.com/mineiros-io/terraform-github-team.git
cd terraform-github-team/examples/github-team
```

### Initializing Terraform

Run `terraform init` to initialize the example and download providers and the module.

### Planning the example

Run `terraform plan` to see a plan of the changes.

### Applying the example

Run `terraform apply` to create the resources.
You will see a plan of the changes and Terraform will prompt you for approval to actually apply the changes.

### Destroying the example

Run `terraform destroy` to destroy all resources again.

<!-- References -->

<!-- markdown-link-check-disable -->
[main.tf]: https://github.com/mineiros-io/terraform-github-team/blob/master/examples/github-team/main.tf
<!-- markdown-link-check-enable -->
[homepage]: https://mineiros.io/?ref=terraform-github-team

[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

[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
69 changes: 69 additions & 0 deletions examples/github-team/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# ----------------------------------------------------------------------------------------------------------------------
# CREATE A TEAM AND TWO REPOSITORIES
#
# We create a team and two repositories. The team will have pull permissions for one repository and push permissions
# for the other. We also add lists of members and maintainers to the team.
# ----------------------------------------------------------------------------------------------------------------------

# ----------------------------------------------------------------------------------------------------------------------
# ENVIRONMENT VARIABLES:
# ----------------------------------------------------------------------------------------------------------------------
# You can provide your credentials via the
# AWS_ACCESS_KEY_ID and
# AWS_SECRET_ACCESS_KEY, environment variables,
# representing your AWS Access Key and AWS Secret Key, respectively.
# Note that setting your AWS credentials using either these (or legacy)
# environment variables will override the use of
# AWS_SHARED_CREDENTIALS_FILE and
# AWS_PROFILE.
# The
# AWS_DEFAULT_REGION and
# AWS_SESSION_TOKEN environment variables are also used, if applicable.
# ----------------------------------------------------------------------------------------------------------------------

# ----------------------------------------------------------------------------------------------------------------------
# Provider Setup
# ----------------------------------------------------------------------------------------------------------------------

provider "aws" {
version = "~> 2.0"
region = "eu-west-1"
}


resource "github_repository" "repository" {
name = "engineering-tools"
}

resource "github_repository" "another_repository" {
name = "devops-tools"
}

module "team" {
source = "mineiros-io/team/github"
version = "0.1.3"

name = "Engineering"
description = "This team is created with terraform to test the terraformn-github-repository module."
privacy = "closed"

members = ["alice"]
maintainers = ["bob"]

pull_repositories = [
github_repository.repository.name,
]

push_repositories = [
github_repository.another_repository.name,
]
}

module "child_team" {
source = "mineiros-io/team/github"
version = "0.1.3"

name = "DevOps"
parent_team_id = module.team.id
privacy = "closed"
}
File renamed without changes.
42 changes: 0 additions & 42 deletions examples/public-repositories-with-team/main.tf

This file was deleted.

Loading

0 comments on commit 8ab1bef

Please sign in to comment.