diff --git a/go.mod b/go.mod index 74c048b67..0f4ad081b 100644 --- a/go.mod +++ b/go.mod @@ -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 @@ -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 ) diff --git a/go.sum b/go.sum index c2690a245..0755849b0 100644 --- a/go.sum +++ b/go.sum @@ -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= @@ -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= diff --git a/tfe/resource_tfe_ssh_key.go b/tfe/resource_tfe_ssh_key.go index 562dedf35..461d9a2c4 100644 --- a/tfe/resource_tfe_ssh_key.go +++ b/tfe/resource_tfe_ssh_key.go @@ -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()) diff --git a/tfe/resource_tfe_ssh_key_test.go b/tfe/resource_tfe_ssh_key_test.go index 70b1d33a4..fa992cb2b 100644 --- a/tfe/resource_tfe_ssh_key_test.go +++ b/tfe/resource_tfe_ssh_key_test.go @@ -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"), ), }, }, @@ -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) } diff --git a/tfe/resource_tfe_team.go b/tfe/resource_tfe_team.go index e805b7587..d3f2f89c5 100644 --- a/tfe/resource_tfe_team.go +++ b/tfe/resource_tfe_team.go @@ -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, + }, }, }, }, @@ -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)), } } @@ -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) @@ -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)), } } diff --git a/tfe/resource_tfe_team_test.go b/tfe/resource_tfe_team_test.go index a8e88bbd0..0df4d8313 100644 --- a/tfe/resource_tfe_team_test.go +++ b/tfe/resource_tfe_team_test.go @@ -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"), ), }, }, @@ -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"), ), }, { @@ -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"), ), }, }, @@ -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) } @@ -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) } diff --git a/website/docs/r/team.html.markdown b/website/docs/r/team.html.markdown index 0b5ae9e1c..a9eac511a 100644 --- a/website/docs/r/team.html.markdown +++ b/website/docs/r/team.html.markdown @@ -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