Skip to content

Migrate teams write tools - #507

Open
jaylonmcshan19-x wants to merge 2 commits into
mainfrom
migrate-teams-write-tools
Open

Migrate teams write tools#507
jaylonmcshan19-x wants to merge 2 commits into
mainfrom
migrate-teams-write-tools

Conversation

@jaylonmcshan19-x

@jaylonmcshan19-x jaylonmcshan19-x commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

PCI review checklist

This is the second PR for TFECO-13099, the three write team tools. This is on top of migrate list_teams and get_team to the official go-sdk in order to keep the diff smal, and the PR easier to read.

one thing worth mentioning:

grant_team_access returns one TeamAccessGrant with workspace_id and project_id both optional, instead of the two separate summary types the mark3labs version has. the SDK only generates one output schema per tool so it can't return two of the shape, and only one of the IDs is ever set anyway so it should be no biggie.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

@Marin2409 Marin2409 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good to me, one small thing tho: take a look at #509 for the tool file naming convention. Rather than grouping tools into larger file buckets, I went with one file per tool, using the type prefix and -tool suffix, e.g. projects_list_tool.go

Let me know what you think. I feel like this approach might be a little easier to navigate and to read

Comment on lines +333 to +334
Username string `json:"username,omitempty" jsonschema:"Username of the member to add. Only works for users who have accepted the organization invite"`
OrganizationMembershipID string `json:"organization_membership_id,omitempty" jsonschema:"Organization membership ID of the member to add (e.g. ou-abc123). Works for both accepted and pending organization invites. Prefer this over username when the invitee has not yet accepted"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: here I'd just add a small note to these inputs saying that these are "Mutually exclusive with..." the same way you are doing here with GrantTeamAccessArguments just to keep the consistency:

	//one of these must be provided
	WorkspaceID string `json:"workspace_id,omitempty" jsonschema:"The ID of the workspace to grant the team access to. Workspace IDs begin with ws- (e.g. ws-abc123def456). Mutually exclusive with project_id"`
	ProjectID   string `json:"project_id,omitempty" jsonschema:"The ID of the project to grant the team access to. Project IDs begin with prj- (e.g. prj-abc123def456). Mutually exclusive with workspace_id"`

@Marin2409 Marin2409 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple small things

Comment on lines +127 to +130
tfeClient, err := client.GetTfeClient(ctx)
if err != nil {
return nil, nil, err
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small thing: dont forget to pass your session ID (client.SessionIDFromRequest(request)) when getting the client, like this:

tfeClient, err := client.GetTfeClient(ctx, client.SessionIDFromRequest(request))
if err != nil {
	return nil, nil, fmt.Errorf("getting Terraform client: %w", err)
}

Comment on lines +184 to +187
tfeClient, err := client.GetTfeClient(ctx)
if err != nil {
return nil, nil, err
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too

Comment on lines +295 to +298
tfeClient, err := client.GetTfeClient(ctx)
if err != nil {
return nil, nil, err
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too

Comment on lines +362 to +365
tfeClient, err := client.GetTfeClient(ctx)
if err != nil {
return nil, nil, err
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too

Comment on lines +442 to +445
tfeClient, err := client.GetTfeClient(ctx)
if err != nil {
return nil, nil, err
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants