Skip to content

Commit

Permalink
Allow for multiple teams (#4)
Browse files Browse the repository at this point in the history
* feat(variables): use team_ids instead of single name

* feat(README)
  • Loading branch information
erikreinert authored Sep 23, 2023
1 parent 8bcb299 commit 08329b7
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Nix directories
.direnv
result

# Local .terraform directories
Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
# terraform-tfe-project
Terraform module which creates Terraform Enterprise project resources.

## Migration Changes

### 0.3.0

- Added the `team_ids` to `variables.tf` which replaces `team_name` allowing for multiple teams to be added to projects

<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_tfe"></a> [tfe](#requirement\_tfe) | 0.45.0 |
| <a name="requirement_tfe"></a> [tfe](#requirement\_tfe) | 0.48.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_tfe"></a> [tfe](#provider\_tfe) | 0.45.0 |
| <a name="provider_tfe"></a> [tfe](#provider\_tfe) | 0.48.0 |

## Modules

Expand All @@ -22,9 +28,8 @@ No modules.

| Name | Type |
|------|------|
| [tfe_project.self](https://registry.terraform.io/providers/hashicorp/tfe/0.45.0/docs/resources/project) | resource |
| [tfe_team_project_access.self](https://registry.terraform.io/providers/hashicorp/tfe/0.45.0/docs/resources/team_project_access) | resource |
| [tfe_team.self](https://registry.terraform.io/providers/hashicorp/tfe/0.45.0/docs/data-sources/team) | data source |
| [tfe_project.self](https://registry.terraform.io/providers/hashicorp/tfe/0.48.0/docs/resources/project) | resource |
| [tfe_team_project_access.self](https://registry.terraform.io/providers/hashicorp/tfe/0.48.0/docs/resources/team_project_access) | resource |

## Inputs

Expand All @@ -33,11 +38,11 @@ No modules.
| <a name="input_description"></a> [description](#input\_description) | The description of the project | `string` | n/a | yes |
| <a name="input_name"></a> [name](#input\_name) | The name of the project | `string` | n/a | yes |
| <a name="input_organization_name"></a> [organization\_name](#input\_organization\_name) | The name of the organization | `string` | n/a | yes |
| <a name="input_team_name"></a> [team\_name](#input\_team\_name) | The name of the team | `string` | n/a | yes |
| <a name="input_team_ids"></a> [team\_ids](#input\_team\_ids) | The name of the team | `list(string)` | `[]` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_name"></a> [name](#output\_name) | The name of the project |
<!-- END_TF_DOCS -->
<!-- END_TF_DOCS -->
5 changes: 1 addition & 4 deletions data.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
data "tfe_team" "self" {
name = var.team_name
organization = var.organization_name
}

4 changes: 3 additions & 1 deletion project.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ resource "tfe_project" "self" {
}

resource "tfe_team_project_access" "self" {
for_each = toset(var.team_ids)

access = "maintain"
project_id = tfe_project.self.id
team_id = data.tfe_team.self.id
team_id = each.key
}
5 changes: 3 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ variable "organization_name" {
type = string
}

variable "team_name" {
variable "team_ids" {
default = []
description = "The name of the team"
type = string
type = list(string)
}

0 comments on commit 08329b7

Please sign in to comment.