Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/ega4432/terraform-github-org-setup

This is a Terraform module to invite members to your organization and create each repositories.
https://github.com/ega4432/terraform-github-org-setup

github-provider terraform terraform-module

Last synced: about 1 month ago
JSON representation

This is a Terraform module to invite members to your organization and create each repositories.

Awesome Lists containing this project

README

        

# terraform-github-org-setup

[![CI](https://github.com/ega4432/terraform-github-org-setup/actions/workflows/ci.yaml/badge.svg)](https://github.com/ega4432/terraform-github-org-setup/actions/workflows/ci.yaml)

## Usage

`main.tf`

```tf
module "organization" {
source = "[email protected]:ega4432/terraform-github-org-setup.git"

org_settings = {
billing_email = var.billing_email
default_repository_permission = var.default_repository_permission
}

admins = var.admins
members = var.members
}
```

`*.tfvars`

```tf
github_pat = "YOUR_GITHUB_PERSONAL_ACCESS_TOKEN"

billing_email = "YOUR_ORGANIZATION_USER_EMAIL"
default_repository_permission = "none" # Repository permissions for members (default to "read only")
org_name = "YOUR_ORGANIZATION_NAME"

admins = [] # YOUR_ORGANIZATION_ADMIN_USERS
members = [ # YOUR_ORGANIZATION_MEMBERS
{
user = "xxx"
fullname = "xxx xxx"
}
{
user = "yyy"
fullname = "yyy yyy"
}
]
```

Once you have prepared the necessary files as described above, execute the following command.

```sh
$ terraform init

$ terraform plan -var-file .tfvars -out=tfplan

$ terraform apply tfplan
```

See [example](https://github.com/ega4432/terraform-github-org-setup/tree/main/examples/organization) for more information.

## Test

The Go library called [Terratest](https://github.com/gruntwork-io/terratest) is used for testing.

```sh
$ cd test/

$ go test -timeout 1m
```