Migrate teams write tools - #507
Conversation
Marin2409
left a comment
There was a problem hiding this comment.
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
| 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"` |
There was a problem hiding this comment.
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"`| tfeClient, err := client.GetTfeClient(ctx) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } |
There was a problem hiding this comment.
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)
}| tfeClient, err := client.GetTfeClient(ctx) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } |
| tfeClient, err := client.GetTfeClient(ctx) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } |
| tfeClient, err := client.GetTfeClient(ctx) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } |
| tfeClient, err := client.GetTfeClient(ctx) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } |
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_accessreturns oneTeamAccessGrantwithworkspace_idandproject_idboth optional, instead of the two separate summary types themark3labsversion 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.