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

registry permissions + upgrade breaking changes #432

Merged
merged 3 commits into from
Feb 14, 2022
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
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