Skip to content

Commit

Permalink
fix: values default for permissions (hadenlabs#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
luismayta committed Oct 2, 2021
1 parent 0e21a3a commit 805801c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions docs/include/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_maintainers"></a> [maintainers](#input\_maintainers) | This members role maintainers | `list(string)` | `null` | no |
| <a name="input_members"></a> [members](#input\_members) | This members role member | `list(string)` | `null` | no |
| <a name="input_permissions"></a> [permissions](#input\_permissions) | Add permissions of repository for team | <pre>list(object({<br> repository = string<br> permission = string<br> }))</pre> | `null` | no |
| <a name="input_maintainers"></a> [maintainers](#input\_maintainers) | This members role maintainers | `list(string)` | `[]` | no |
| <a name="input_members"></a> [members](#input\_members) | This members role member | `list(string)` | `[]` | no |
| <a name="input_permissions"></a> [permissions](#input\_permissions) | Add permissions of repository for team | <pre>list(object({<br> repository = string<br> permission = string<br> }))</pre> | `[]` | no |
| <a name="input_team"></a> [team](#input\_team) | This team to create | <pre>object({<br> name = string<br> description = string<br> privacy = string<br> })</pre> | n/a | yes |

## Outputs
Expand Down
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ resource "github_team" "this" {
}

resource "github_team_membership" "maintainers" {
count = length(var.maintainers)
count = length(try(var.maintainers, 0))
team_id = github_team.this.id
username = element(var.maintainers, count.index)
role = "maintainer"
depends_on = [github_team.this]
}

resource "github_team_membership" "members" {
count = length(var.members)
count = length(try(var.members, 0))
team_id = github_team.this.id
username = element(var.members, count.index)
role = "member"
depends_on = [github_team.this]
}

resource "github_team_repository" "this" {
count = length(var.permissions)
count = length(try(var.permissions, 0))
team_id = github_team.this.id
repository = element(var.permissions, count.index).repository
permission = element(var.permissions, count.index).permission
Expand Down
6 changes: 3 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ variable "team" {
variable "maintainers" {
description = "This members role maintainers"
type = list(string)
default = null
default = []
}

variable "members" {
description = "This members role member"
type = list(string)
default = null
default = []
}

variable "permissions" {
Expand All @@ -25,5 +25,5 @@ variable "permissions" {
repository = string
permission = string
}))
default = null
default = []
}

0 comments on commit 805801c

Please sign in to comment.