Skip to content

Commit

Permalink
Merge pull request #450 from hashicorp/migrate-go-tfe-1_0
Browse files Browse the repository at this point in the history
Migrate the provider to go-tfe v1.0.0
  • Loading branch information
sebasslash authored Mar 24, 2022
2 parents 996e61f + a94187b commit 48e7bd2
Show file tree
Hide file tree
Showing 26 changed files with 76 additions and 46 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ require (
github.com/hashicorp/go-hclog v0.16.1 // indirect
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.25.0
github.com/hashicorp/go-slug v0.8.0
github.com/hashicorp/go-tfe v1.0.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-20220210224613-90d013bbcef8 // indirect
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
google.golang.org/api v0.44.0-impersonate-preview // indirect
google.golang.org/protobuf v1.27.1 // indirect
)
Expand Down
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,20 @@ github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhE
github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I=
github.com/hashicorp/go-slug v0.7.0 h1:8HIi6oreWPtnhpYd8lIGQBgp4rXzDWQTOhfILZm+nok=
github.com/hashicorp/go-slug v0.7.0/go.mod h1:Ib+IWBYfEfJGI1ZyXMGNbu2BU+aa3Dzu41RKLH301v4=
github.com/hashicorp/go-slug v0.8.0 h1:h7AGtXVAI/cJ/Wwa/JQQaftQnWQmZbAzkzgZeZVVmLw=
github.com/hashicorp/go-slug v0.8.0/go.mod h1:Ib+IWBYfEfJGI1ZyXMGNbu2BU+aa3Dzu41RKLH301v4=
github.com/hashicorp/go-tfe v0.22.0 h1:FBK3LscU90EhQGS/p2NJJdJt2GzwiGNqHgex8SjZ+LM=
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-tfe v0.26.0 h1:6vQshg2NW5CkN4fkM64qhX+Z5Ua7ip74n8nAJRlhKKg=
github.com/hashicorp/go-tfe v0.26.0/go.mod h1:gyXLXbpBVxA2F/6opah8XBsOkZJxHYQmghl0OWi8keI=
github.com/hashicorp/go-tfe v1.0.0-rc1 h1:ZUAfDF5en/oayJJByxm3lQCsIRbCPNpf9RqBFhb3Crs=
github.com/hashicorp/go-tfe v1.0.0-rc1/go.mod h1:gyXLXbpBVxA2F/6opah8XBsOkZJxHYQmghl0OWi8keI=
github.com/hashicorp/go-tfe v1.0.0 h1:CmwoHrOs7WJfD/yEmVjJ65+dyKeVRrgvRHBLVSQQ6Ks=
github.com/hashicorp/go-tfe v1.0.0/go.mod h1:tJF/OlAXzVbmjiimAPLplSLgwg6kZDUOy0MzHuMwvF4=
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 @@ -563,6 +571,8 @@ golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13W
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/time v0.0.0-20220224211638-0e9765cccd65 h1:M73Iuj3xbbb9Uk1DYhzydthsj6oOd6l9bpuFcNoUvTs=
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65/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
6 changes: 3 additions & 3 deletions tfe/client_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func newMockWorkspaces(options testClientOptions) *mockWorkspaces {
}
}

func (m *mockWorkspaces) List(ctx context.Context, organization string, options tfe.WorkspaceListOptions) (*tfe.WorkspaceList, error) {
func (m *mockWorkspaces) List(ctx context.Context, organization string, options *tfe.WorkspaceListOptions) (*tfe.WorkspaceList, error) {
panic("not implemented")
}

Expand Down Expand Up @@ -113,7 +113,7 @@ func (m *mockWorkspaces) UnassignSSHKey(ctx context.Context, workspaceID string)
panic("not implemented")
}

func (m *mockWorkspaces) RemoteStateConsumers(ctx context.Context, workspaceID string, options *tfe.RemoteStateConsumersListOptions) (*tfe.WorkspaceList, error) {
func (m *mockWorkspaces) ListRemoteStateConsumers(ctx context.Context, workspaceID string, options *tfe.RemoteStateConsumersListOptions) (*tfe.WorkspaceList, error) {
if m.options.remoteStateConsumersResponse == "404" {
return nil, tfe.ErrResourceNotFound
} else if m.options.remoteStateConsumersResponse == "500" {
Expand All @@ -135,7 +135,7 @@ func (m *mockWorkspaces) UpdateRemoteStateConsumers(ctx context.Context, workspa
panic("not implemented")
}

func (m *mockWorkspaces) Tags(ctx context.Context, workspaceID string, options tfe.WorkspaceTagListOptions) (*tfe.TagList, error) {
func (m *mockWorkspaces) ListTags(ctx context.Context, workspaceID string, options *tfe.WorkspaceTagListOptions) (*tfe.TagList, error) {
panic("not implemented")
}

Expand Down
2 changes: 1 addition & 1 deletion tfe/data_source_agent_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func dataSourceTFEAgentPoolRead(d *schema.ResourceData, meta interface{}) error
options := tfe.AgentPoolListOptions{}

for {
l, err := tfeClient.AgentPools.List(ctx, organization, options)
l, err := tfeClient.AgentPools.List(ctx, organization, &options)
if err != nil {
return fmt.Errorf("Error retrieving agent pools: %v", err)
}
Expand Down
5 changes: 3 additions & 2 deletions tfe/data_source_organization_membership.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tfe

import (
"fmt"

"github.com/hashicorp/go-tfe"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down Expand Up @@ -37,8 +38,8 @@ func dataSourceTFEOrganizationMembershipRead(d *schema.ResourceData, meta interf
organization := d.Get("organization").(string)

// Create an options struct.
options := tfe.OrganizationMembershipListOptions{
Include: "user",
options := &tfe.OrganizationMembershipListOptions{
Include: []tfe.OrgMembershipIncludeOpt{tfe.OrgMembershipUser},
}

for {
Expand Down
4 changes: 2 additions & 2 deletions tfe/data_source_organizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func adminOrgsPopulateFields(client *tfe.Client, d *schema.ResourceData) ([]stri
names := []string{}
ids := map[string]string{}
log.Printf("[DEBUG] Listing all organizations (admin)")
options := tfe.AdminOrganizationListOptions{
options := &tfe.AdminOrganizationListOptions{
ListOptions: tfe.ListOptions{
PageSize: 100,
},
Expand Down Expand Up @@ -94,7 +94,7 @@ func orgsPopulateFields(client *tfe.Client) ([]string, map[string]string, error)
names := []string{}
ids := map[string]string{}
log.Printf("[DEBUG] Listing all organizations (non-admin)")
options := tfe.OrganizationListOptions{
options := &tfe.OrganizationListOptions{
ListOptions: tfe.ListOptions{
PageSize: 100,
},
Expand Down
2 changes: 1 addition & 1 deletion tfe/data_source_outputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ type outputData struct {
func (d dataSourceOutputs) readStateOutput(ctx context.Context, tfeClient *tfe.Client, orgName, wsName string) (*stateData, error) {
log.Printf("[DEBUG] Reading the Workspace %s in Organization %s", wsName, orgName)
opts := &tfe.WorkspaceReadOptions{
Include: "outputs",
Include: []tfe.WSIncludeOpt{tfe.WSOutputs},
}
ws, err := tfeClient.Workspaces.ReadWithOptions(ctx, orgName, wsName, opts)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion tfe/data_source_ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func dataSourceTFESSHKeyRead(d *schema.ResourceData, meta interface{}) error {
organization := d.Get("organization").(string)

// Create an options struct.
options := tfe.SSHKeyListOptions{}
options := &tfe.SSHKeyListOptions{}

for {
l, err := tfeClient.SSHKeys.List(ctx, organization, options)
Expand Down
2 changes: 1 addition & 1 deletion tfe/data_source_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func dataSourceTFETeamRead(d *schema.ResourceData, meta interface{}) error {
organization := d.Get("organization").(string)

// Create an options struct.
options := tfe.TeamListOptions{}
options := &tfe.TeamListOptions{}

for {
l, err := tfeClient.Teams.List(ctx, organization, options)
Expand Down
4 changes: 2 additions & 2 deletions tfe/data_source_team_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ func dataSourceTFETeamAccessRead(d *schema.ResourceData, meta interface{}) error
}

// Create an options struct.
options := tfe.TeamAccessListOptions{
WorkspaceID: tfe.String(ws.ID),
options := &tfe.TeamAccessListOptions{
WorkspaceID: ws.ID,
}

for {
Expand Down
2 changes: 1 addition & 1 deletion tfe/data_source_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func dataSourceVariableRead(d *schema.ResourceData, meta interface{}) error {
totalEnvVariables := make([]interface{}, 0)
totalTerraformVariables := make([]interface{}, 0)

options := tfe.VariableListOptions{}
options := &tfe.VariableListOptions{}

for {
variableList, err := tfeClient.Variables.List(ctx, workspaceID, options)
Expand Down
4 changes: 2 additions & 2 deletions tfe/data_source_workspace_ids.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func dataSourceTFEWorkspaceIDsRead(d *schema.ResourceData, meta interface{}) err
fullNames := make(map[string]string, len(names))
ids := make(map[string]string, len(names))

options := tfe.WorkspaceListOptions{}
options := &tfe.WorkspaceListOptions{}

// Create a search string with all the tag names we are looking for.
var tagSearchParts []string
Expand All @@ -81,7 +81,7 @@ func dataSourceTFEWorkspaceIDsRead(d *schema.ResourceData, meta interface{}) err
}
if len(tagSearchParts) > 0 {
tagSearch := strings.Join(tagSearchParts, ",")
options.Tags = &tagSearch
options.Tags = tagSearch
}

hasOnlyTags := len(tagSearchParts) > 0 && len(names) == 0
Expand Down
4 changes: 2 additions & 2 deletions tfe/resource_tfe_agent_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ func resourceTFEAgentTokenCreate(d *schema.ResourceData, meta interface{}) error
description := d.Get("description").(string)

// Create a new options struct
options := tfe.AgentTokenGenerateOptions{
options := tfe.AgentTokenCreateOptions{
Description: tfe.String(description),
}

log.Printf("[DEBUG] Create new agent token for agent pool ID: %s", agentPoolID)
agentToken, err := tfeClient.AgentTokens.Generate(ctx, agentPoolID, options)
agentToken, err := tfeClient.AgentTokens.Create(ctx, agentPoolID, options)
if err != nil {
return fmt.Errorf("Error creating agent token for agent pool ID %s: %v", agentPoolID, err)

Expand Down
4 changes: 2 additions & 2 deletions tfe/resource_tfe_notification_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func resourceTFENotificationConfigurationCreate(d *schema.ResourceData, meta int

// Add triggers set to the options struct
for _, trigger := range d.Get("triggers").(*schema.Set).List() {
options.Triggers = append(options.Triggers, trigger.(string))
options.Triggers = append(options.Triggers, tfe.NotificationTriggerType(trigger.(string)))
}

// Add email_addresses set to the options struct
Expand Down Expand Up @@ -271,7 +271,7 @@ func resourceTFENotificationConfigurationUpdate(d *schema.ResourceData, meta int

// Add triggers set to the options struct
for _, trigger := range d.Get("triggers").(*schema.Set).List() {
options.Triggers = append(options.Triggers, trigger.(string))
options.Triggers = append(options.Triggers, tfe.NotificationTriggerType(trigger.(string)))
}

// Add email_addresses set to the options struct
Expand Down
6 changes: 3 additions & 3 deletions tfe/resource_tfe_notification_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ func testAccCheckTFENotificationConfigurationAttributesUpdate(notificationConfig

// Token is write only, can't read it

if !reflect.DeepEqual(notificationConfiguration.Triggers, []string{tfe.NotificationTriggerCreated, tfe.NotificationTriggerNeedsAttention}) {
if !reflect.DeepEqual(notificationConfiguration.Triggers, []string{string(tfe.NotificationTriggerCreated), string(tfe.NotificationTriggerNeedsAttention)}) {
return fmt.Errorf("Bad triggers: %v", notificationConfiguration.Triggers)
}

Expand Down Expand Up @@ -598,7 +598,7 @@ func testAccCheckTFENotificationConfigurationAttributesUpdateEmailUserIDs(notifi

// Token is write only, can't read it

if !reflect.DeepEqual(notificationConfiguration.Triggers, []string{tfe.NotificationTriggerCreated, tfe.NotificationTriggerNeedsAttention}) {
if !reflect.DeepEqual(notificationConfiguration.Triggers, []string{string(tfe.NotificationTriggerCreated), string(tfe.NotificationTriggerNeedsAttention)}) {
return fmt.Errorf("Bad triggers: %v", notificationConfiguration.Triggers)
}

Expand Down Expand Up @@ -654,7 +654,7 @@ func testAccCheckTFENotificationConfigurationAttributesDuplicateTriggers(notific

// Token is write only, can't read it

if !reflect.DeepEqual(notificationConfiguration.Triggers, []string{tfe.NotificationTriggerCreated}) {
if !reflect.DeepEqual(notificationConfiguration.Triggers, []string{string(tfe.NotificationTriggerCreated)}) {
return fmt.Errorf("Bad triggers: %v", notificationConfiguration.Triggers)
}

Expand Down
2 changes: 1 addition & 1 deletion tfe/resource_tfe_organization_membership.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func resourceTFEOrganizationMembershipRead(d *schema.ResourceData, meta interfac
tfeClient := meta.(*tfe.Client)

options := tfe.OrganizationMembershipReadOptions{
Include: "user",
Include: []tfe.OrgMembershipIncludeOpt{tfe.OrgMembershipUser},
}

log.Printf("[DEBUG] Read configuration of membership: %s", d.Id())
Expand Down
2 changes: 1 addition & 1 deletion tfe/resource_tfe_organization_membership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func testAccCheckTFEOrganizationMembershipExists(
}

options := tfe.OrganizationMembershipReadOptions{
Include: "user",
Include: []tfe.OrgMembershipIncludeOpt{tfe.OrgMembershipUser},
}

m, err := tfeClient.OrganizationMemberships.ReadWithOptions(ctx, rs.Primary.ID, options)
Expand Down
2 changes: 1 addition & 1 deletion tfe/resource_tfe_organization_module_sharing.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func resourceTFEOrganizationModuleSharingUpdate(d *schema.ResourceData, meta int
func resourceTFEOrganizationModuleSharingRead(d *schema.ResourceData, meta interface{}) error {
tfeClient := meta.(*tfe.Client)

options := tfe.AdminOrganizationListModuleConsumersOptions{}
options := &tfe.AdminOrganizationListModuleConsumersOptions{}

log.Printf("[DEBUG] Read configuration of module sharing for organization: %s", d.Id())
for {
Expand Down
2 changes: 1 addition & 1 deletion tfe/resource_tfe_organization_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func resourceTFEOrganizationTokenCreate(d *schema.ResourceData, meta interface{}
log.Printf("[DEBUG] Regenerating existing token for organization: %s", organization)
}

token, err := tfeClient.OrganizationTokens.Generate(ctx, organization)
token, err := tfeClient.OrganizationTokens.Create(ctx, organization)
if err != nil {
return fmt.Errorf(
"Error creating new token for organization %s: %v", organization, err)
Expand Down
17 changes: 12 additions & 5 deletions tfe/resource_tfe_registry_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ func resourceTFERegistryModuleCreate(d *schema.ResourceData, meta interface{}) e
}

err = resource.Retry(time.Duration(5)*time.Minute, func() *resource.RetryError {
_, err := tfeClient.RegistryModules.Read(ctx, registryModule.Organization.Name, registryModule.Name, registryModule.Provider)
rmID := tfe.RegistryModuleID{
Organization: registryModule.Organization.Name,
Name: registryModule.Name,
Provider: registryModule.Provider,
}
_, err := tfeClient.RegistryModules.Read(ctx, rmID)
if err != nil {
if strings.Contains(strings.ToLower(err.Error()), "not found") {
return resource.RetryableError(err)
Expand Down Expand Up @@ -118,11 +123,13 @@ func resourceTFERegistryModuleRead(d *schema.ResourceData, meta interface{}) err
log.Printf("[DEBUG] Read registry module: %s", d.Id())

// Get the fields we need to read the registry module
organization := d.Get("organization").(string)
name := d.Get("name").(string)
module_provider := d.Get("module_provider").(string)
rmID := tfe.RegistryModuleID{
Organization: d.Get("organization").(string),
Name: d.Get("name").(string),
Provider: d.Get("module_provider").(string),
}

registryModule, err := tfeClient.RegistryModules.Read(ctx, organization, name, module_provider)
registryModule, err := tfeClient.RegistryModules.Read(ctx, rmID)
if err != nil {
if err == tfe.ErrResourceNotFound {
log.Printf("[DEBUG] Registry module %s no longer exists", d.Id())
Expand Down
15 changes: 13 additions & 2 deletions tfe/resource_tfe_registry_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ func testAccCheckTFERegistryModuleExists(n, orgName string, registryModule *tfe.
return fmt.Errorf("No instance ID is set")
}

rm, err := tfeClient.RegistryModules.Read(ctx, orgName, getRegistryModuleName(), getRegistryModuleProvider())
rmID := tfe.RegistryModuleID{
Organization: orgName,
Name: getRegistryModuleName(),
Provider: getRegistryModuleProvider(),
}

rm, err := tfeClient.RegistryModules.Read(ctx, rmID)
if err != nil {
return err
}
Expand Down Expand Up @@ -183,7 +189,12 @@ func testAccCheckTFERegistryModuleDestroy(s *terraform.State) error {
return fmt.Errorf("No module_provider is set for registry module %s", id)
}

_, err := tfeClient.RegistryModules.Read(ctx, organization, name, module_provider)
rmID := tfe.RegistryModuleID{
Organization: organization,
Name: name,
Provider: module_provider,
}
_, err := tfeClient.RegistryModules.Read(ctx, rmID)
if err == nil {
return fmt.Errorf("Registry module %s still exists", id)
}
Expand Down
2 changes: 1 addition & 1 deletion tfe/resource_tfe_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func resourceTFETeamCreate(d *schema.ResourceData, meta interface{}) error {
team, err := tfeClient.Teams.Create(ctx, organization, options)
if err != nil {
if err == tfe.ErrResourceNotFound {
entitlements, _ := tfeClient.Organizations.Entitlements(ctx, organization)
entitlements, _ := tfeClient.Organizations.ReadEntitlements(ctx, organization)
if entitlements == nil {
return fmt.Errorf("Error creating team %s for organization %s: %v", name, organization, err)
}
Expand Down
2 changes: 1 addition & 1 deletion tfe/resource_tfe_team_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func resourceTFETeamTokenCreate(d *schema.ResourceData, meta interface{}) error
}

log.Printf("[DEBUG] Create new token for team: %s", teamID)
token, err := tfeClient.TeamTokens.Generate(ctx, teamID)
token, err := tfeClient.TeamTokens.Create(ctx, teamID)
if err != nil {
return fmt.Errorf(
"Error creating new token for team %s: %v", teamID, err)
Expand Down
5 changes: 3 additions & 2 deletions tfe/tfe_sweeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package tfe
import (
"context"
"fmt"
"github.com/hashicorp/go-tfe"
"log"
"strings"
"testing"

"github.com/hashicorp/go-tfe"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

Expand All @@ -25,7 +26,7 @@ func getOrgSweeper(name string) *resource.Sweeper {
}

ctx := context.TODO()
orgList, err := client.Organizations.List(ctx, tfe.OrganizationListOptions{})
orgList, err := client.Organizations.List(ctx, &tfe.OrganizationListOptions{})
if err != nil {
return fmt.Errorf("Error listing organizations: %s", err)
}
Expand Down
Loading

0 comments on commit 48e7bd2

Please sign in to comment.