Skip to content

Commit

Permalink
Merge pull request #432 from hashicorp/brandonc/registry-permissions-…
Browse files Browse the repository at this point in the history
…with-breaking-changes

registry permissions + upgrade breaking changes
  • Loading branch information
brandonc authored Feb 14, 2022
2 parents 7a27930 + 2cfb9b0 commit 996e61f
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 6 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.0 // indirect
github.com/hashicorp/go-slug v0.7.0
github.com/hashicorp/go-tfe v0.24.0
github.com/hashicorp/go-tfe v0.25.0
github.com/hashicorp/go-version v1.4.0
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce
github.com/hashicorp/hcl/v2 v2.10.0 // indirect
Expand All @@ -30,7 +30,7 @@ require (
golang.org/x/oauth2 v0.0.0-20210622215436-a8dc77f794b6 // indirect
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
google.golang.org/api v0.44.0-impersonate-preview // indirect
google.golang.org/protobuf v1.27.1 // indirect
)
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ github.com/hashicorp/go-tfe v0.22.0 h1:FBK3LscU90EhQGS/p2NJJdJt2GzwiGNqHgex8SjZ+
github.com/hashicorp/go-tfe v0.22.0/go.mod h1:gyXLXbpBVxA2F/6opah8XBsOkZJxHYQmghl0OWi8keI=
github.com/hashicorp/go-tfe v0.24.0 h1:7RyYTafFXGN6I6ayASJOpw6pARtKKSPdA9KRiovKQRM=
github.com/hashicorp/go-tfe v0.24.0/go.mod h1:gyXLXbpBVxA2F/6opah8XBsOkZJxHYQmghl0OWi8keI=
github.com/hashicorp/go-tfe v0.25.0 h1:eAqKG6hpxfjiw4KJheTeFhevov1avDPJFDDI0F/OAJU=
github.com/hashicorp/go-tfe v0.25.0/go.mod h1:gyXLXbpBVxA2F/6opah8XBsOkZJxHYQmghl0OWi8keI=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE=
Expand Down Expand Up @@ -559,6 +561,8 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M=
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44=
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
Expand Down
3 changes: 1 addition & 2 deletions tfe/resource_tfe_ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ func resourceTFESSHKeyUpdate(d *schema.ResourceData, meta interface{}) error {

// Create a new options struct.
options := tfe.SSHKeyUpdateOptions{
Name: tfe.String(d.Get("name").(string)),
Value: tfe.String(d.Get("key").(string)),
Name: tfe.String(d.Get("name").(string)),
}

log.Printf("[DEBUG] Update SSH key: %s", d.Id())
Expand Down
4 changes: 2 additions & 2 deletions tfe/resource_tfe_ssh_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestAccTFESSHKey_update(t *testing.T) {
resource.TestCheckResourceAttr(
"tfe_ssh_key.foobar", "name", "ssh-key-updated"),
resource.TestCheckResourceAttr(
"tfe_ssh_key.foobar", "key", "UPDATED-SSH-KEY-CONTENT"),
"tfe_ssh_key.foobar", "key", "SSH-KEY-CONTENT"),
),
},
},
Expand Down Expand Up @@ -168,6 +168,6 @@ resource "tfe_organization" "foobar" {
resource "tfe_ssh_key" "foobar" {
name = "ssh-key-updated"
organization = tfe_organization.foobar.id
key = "UPDATED-SSH-KEY-CONTENT"
key = "SSH-KEY-CONTENT"
}`, rInt)
}
16 changes: 16 additions & 0 deletions tfe/resource_tfe_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ func resourceTFETeam() *schema.Resource {
Optional: true,
Default: false,
},
"manage_providers": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"manage_modules": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
},
},
},
Expand Down Expand Up @@ -95,6 +105,8 @@ func resourceTFETeamCreate(d *schema.ResourceData, meta interface{}) error {
ManagePolicyOverrides: tfe.Bool(organizationAccess["manage_policy_overrides"].(bool)),
ManageWorkspaces: tfe.Bool(organizationAccess["manage_workspaces"].(bool)),
ManageVCSSettings: tfe.Bool(organizationAccess["manage_vcs_settings"].(bool)),
ManageProviders: tfe.Bool(organizationAccess["manage_providers"].(bool)),
ManageModules: tfe.Bool(organizationAccess["manage_modules"].(bool)),
}
}

Expand Down Expand Up @@ -144,6 +156,8 @@ func resourceTFETeamRead(d *schema.ResourceData, meta interface{}) error {
"manage_policy_overrides": team.OrganizationAccess.ManagePolicyOverrides,
"manage_workspaces": team.OrganizationAccess.ManageWorkspaces,
"manage_vcs_settings": team.OrganizationAccess.ManageVCSSettings,
"manage_providers": team.OrganizationAccess.ManageProviders,
"manage_modules": team.OrganizationAccess.ManageModules,
}}
if err := d.Set("organization_access", organizationAccess); err != nil {
return fmt.Errorf("error setting organization access for team %s: %s", d.Id(), err)
Expand Down Expand Up @@ -173,6 +187,8 @@ func resourceTFETeamUpdate(d *schema.ResourceData, meta interface{}) error {
ManagePolicyOverrides: tfe.Bool(organizationAccess["manage_policy_overrides"].(bool)),
ManageWorkspaces: tfe.Bool(organizationAccess["manage_workspaces"].(bool)),
ManageVCSSettings: tfe.Bool(organizationAccess["manage_vcs_settings"].(bool)),
ManageProviders: tfe.Bool(organizationAccess["manage_providers"].(bool)),
ManageModules: tfe.Bool(organizationAccess["manage_modules"].(bool)),
}
}

Expand Down
16 changes: 16 additions & 0 deletions tfe/resource_tfe_team_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ func TestAccTFETeam_full(t *testing.T) {
"tfe_team.foobar", "organization_access.0.manage_workspaces", "true"),
resource.TestCheckResourceAttr(
"tfe_team.foobar", "organization_access.0.manage_vcs_settings", "true"),
resource.TestCheckResourceAttr(
"tfe_team.foobar", "organization_access.0.manage_providers", "true"),
resource.TestCheckResourceAttr(
"tfe_team.foobar", "organization_access.0.manage_modules", "true"),
),
},
},
Expand Down Expand Up @@ -94,6 +98,10 @@ func TestAccTFETeam_full_update(t *testing.T) {
"tfe_team.foobar", "organization_access.0.manage_workspaces", "true"),
resource.TestCheckResourceAttr(
"tfe_team.foobar", "organization_access.0.manage_vcs_settings", "true"),
resource.TestCheckResourceAttr(
"tfe_team.foobar", "organization_access.0.manage_providers", "true"),
resource.TestCheckResourceAttr(
"tfe_team.foobar", "organization_access.0.manage_modules", "true"),
),
},
{
Expand All @@ -114,6 +122,10 @@ func TestAccTFETeam_full_update(t *testing.T) {
"tfe_team.foobar", "organization_access.0.manage_workspaces", "false"),
resource.TestCheckResourceAttr(
"tfe_team.foobar", "organization_access.0.manage_vcs_settings", "false"),
resource.TestCheckResourceAttr(
"tfe_team.foobar", "organization_access.0.manage_providers", "false"),
resource.TestCheckResourceAttr(
"tfe_team.foobar", "organization_access.0.manage_modules", "false"),
),
},
},
Expand Down Expand Up @@ -283,6 +295,8 @@ resource "tfe_team" "foobar" {
manage_policy_overrides = true
manage_workspaces = true
manage_vcs_settings = true
manage_providers = true
manage_modules = true
}
}`, rInt)
}
Expand All @@ -305,6 +319,8 @@ resource "tfe_team" "foobar" {
manage_policy_overrides = false
manage_workspaces = false
manage_vcs_settings = false
manage_providers = false
manage_modules = false
}
}`, rInt)
}
2 changes: 2 additions & 0 deletions website/docs/r/team.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ The `organization_access` block supports:
* `manage_policy_overrides` - (Optional) Allows members to override soft-mandatory policy checks.
* `manage_workspaces` - (Optional) Allows members to create and administrate all workspaces within the organization.
* `manage_vcs_settings` - (Optional) Allows members to manage the organization's VCS Providers and SSH keys.
* `manage_providers` - (Optional) Allow members to publish and delete providers in the organization's private registry.
* `manage_modules` - (Optional) Allow members to publish and delete modules in the organization's private registry.

## Attributes Reference

Expand Down

0 comments on commit 996e61f

Please sign in to comment.