Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update team project access to include additional project roles #826

Merged
merged 5 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ FEATURES:
* **New Data Source**: d/tfe_organization_tags is a new data source to allow reading all workspace tags within an organization, by @rhughes1 ([#773](https://github.com/hashicorp/terraform-provider-tfe/pull/773))
* r/workspace, d/workspace: Add `source_name` and `source_url` to workspaces ([#527](https://github.com/hashicorp/terraform-provider-tfe/pull/527))
* `r/tfe_team`: Add `read_projects` and `read_workspaces` to the `organization_access` block. ([#796](https://github.com/hashicorp/terraform-provider-tfe/pull/796))
* r/tfe_team_project_access and d/tfe_team_project_access: Added support for "maintain" and "write" project permissions ([#826](https://github.com/hashicorp/terraform-provider-tfe/pull/826))

ENHANCEMENTS:
* r/tfe_organization_membership: Organization Memberships can now be imported using `<ORGANIZATION NAME>/<USER EMAIL>` ([#715](https://github.com/hashicorp/terraform-provider-tfe/pull/715))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.2 // indirect
github.com/hashicorp/go-slug v0.10.1
github.com/hashicorp/go-tfe v1.19.0
github.com/hashicorp/go-tfe v1.20.0
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce
github.com/hashicorp/hcl/v2 v2.16.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ github.com/hashicorp/go-retryablehttp v0.7.2 h1:AcYqCvkpalPnPF2pn0KamgwamS42TqUD
github.com/hashicorp/go-retryablehttp v0.7.2/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8=
github.com/hashicorp/go-slug v0.10.1 h1:05SCRWCBpCxOeP7stQHvMgOz0raCBCekaytu8Rg/RZ4=
github.com/hashicorp/go-slug v0.10.1/go.mod h1:Ib+IWBYfEfJGI1ZyXMGNbu2BU+aa3Dzu41RKLH301v4=
github.com/hashicorp/go-tfe v1.19.0 h1:CKSrpUfpH0kTF/rC9qrDkKHNgQVHUqnlmSSLyVgVv5g=
github.com/hashicorp/go-tfe v1.19.0/go.mod h1:sk16Tskky9E4ywt0DJN8+qalnHuc11EW45+U8+EaZRs=
github.com/hashicorp/go-tfe v1.20.0 h1:kDxxLbVrhbZiHZp5yN5eIsCCaY2kEU5T9eO1NI8/KRg=
github.com/hashicorp/go-tfe v1.20.0/go.mod h1:sk16Tskky9E4ywt0DJN8+qalnHuc11EW45+U8+EaZRs=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
Expand Down
2 changes: 0 additions & 2 deletions tfe/data_source_team_project_access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
)

func TestAccTFETeamProjectAccessDataSource_basic(t *testing.T) {
skipUnlessBeta(t)

tfeClient, err := getClientUsingEnv()
if err != nil {
t.Fatal(err)
Expand Down
5 changes: 4 additions & 1 deletion tfe/resource_tfe_team_project_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ package tfe
import (
"context"
"errors"
"log"

tfe "github.com/hashicorp/go-tfe"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"log"
)

func resourceTFETeamProjectAccess() *schema.Resource {
Expand All @@ -32,6 +33,8 @@ func resourceTFETeamProjectAccess() *schema.Resource {
ValidateFunc: validation.StringInSlice(
[]string{
string(tfe.TeamProjectAccessAdmin),
string(tfe.TeamProjectAccessWrite),
string(tfe.TeamProjectAccessMaintain),
string(tfe.TeamProjectAccessRead),
},
false,
Expand Down
4 changes: 2 additions & 2 deletions tfe/resource_tfe_team_project_access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

func TestAccTFETeamProjectAccess_admin(t *testing.T) {
func TestAccTFETeamProjectAccess(t *testing.T) {
tmAccess := &tfe.TeamProjectAccess{}
rInt := rand.New(rand.NewSource(time.Now().UnixNano())).Int()

for _, access := range []tfe.TeamProjectAccessType{tfe.TeamProjectAccessAdmin, tfe.TeamProjectAccessRead} {
for _, access := range []tfe.TeamProjectAccessType{tfe.TeamProjectAccessAdmin, tfe.TeamProjectAccessMaintain, tfe.TeamProjectAccessWrite, tfe.TeamProjectAccessRead} {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/team_project_access.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The following arguments are supported:

* `team_id` - (Required) ID of the team to add to the project.
* `project_id` - (Required) ID of the project to which the team will be added.
* `access` - (Required) Type of fixed access to grant. Valid values are `admin` or `read`.
* `access` - (Required) Type of fixed access to grant. Valid values are `admin`, `maintain`, `write`, or `read`.

## Attributes Reference

Expand Down