-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# github-org-member | ||
|
||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.26 | | ||
| <a name="requirement_github"></a> [github](#requirement\_github) | >= 5.7.0 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_github"></a> [github](#provider\_github) | >= 5.7.0 | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [github_membership.member](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/membership) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_role"></a> [role](#input\_role) | The role of the user in the org. One of `admin` or `member`. | `string` | n/a | yes | | ||
| <a name="input_username"></a> [username](#input\_username) | The GitHub username of the user being added to the org. | `string` | n/a | yes | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
terraform { | ||
required_version = ">= 0.12.26" | ||
|
||
required_providers { | ||
github = { | ||
source = "integrations/github" | ||
version = ">= 5.7.0" | ||
} | ||
} | ||
} | ||
|
||
resource "github_membership" "member" { | ||
username = var.username | ||
role = var.role == "admin" ? "admin" : "member" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# --------------------------------------------------------------------------------------------------------------------- | ||
# REQUIRED VARIABLES | ||
# --------------------------------------------------------------------------------------------------------------------- | ||
|
||
variable "username" { | ||
description = "The GitHub username of the user being added to the org." | ||
type = string | ||
} | ||
|
||
variable "role" { | ||
description = "The role of the user in the org. One of `admin` or `member`." | ||
type = string | ||
|
||
validation { | ||
condition = contains(["admin", "member"], var.role) | ||
error_message = "Role must be either `admin` or `member`." | ||
} | ||
} |