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

Add support for fetching organization membership by username #660

Merged
merged 4 commits into from Oct 21, 2022

Conversation

sebasslash
Copy link
Contributor

@sebasslash sebasslash commented Oct 14, 2022

Description

This PR adds a new attribute username to d/tfe_organization_membership, which allows for org memberships to be query-able by username. email is no longer a required attribute and it is now marked as optional given you can supply a name or email. While we don't enforce that one or the other be defined at the schema level, the provider will error if both are not defined or "".

This is a WIP as these changes rely on a unreleased changes to go-tfe, see related pull request.

This PR also adds the same attribute username as a computed property to r/tfe_organization_membership.

@sebasslash sebasslash force-pushed the user-email-search-orgmemberships branch 3 times, most recently from 86f4350 to 4f780b0 Compare October 19, 2022 21:30
@sebasslash sebasslash marked this pull request as ready for review October 19, 2022 21:30
@sebasslash sebasslash requested a review from a team as a code owner October 19, 2022 21:30
@sebasslash sebasslash force-pushed the user-email-search-orgmemberships branch 3 times, most recently from 72628ac to 992492f Compare October 19, 2022 22:47
Copy link
Collaborator

@brandonc brandonc left a comment

Choose a reason for hiding this comment

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

My only blocking feedback is that we should populate username in the state, even when reading using email. My rationale is that this data source reuses resourceTFEOrganizationMembershipRead and that is the behavior of email when fetching by username.

That may mean adding username to the resource schema, which creates a nice symmetry and is free because we already include user data.

tfe/organization_members_helpers.go Outdated Show resolved Hide resolved
@sebasslash sebasslash force-pushed the user-email-search-orgmemberships branch from 992492f to 996b119 Compare October 20, 2022 18:09
@sebasslash sebasslash force-pushed the user-email-search-orgmemberships branch from 996b119 to e984771 Compare October 20, 2022 18:21
Copy link
Collaborator

@brandonc brandonc left a comment

Choose a reason for hiding this comment

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

Yes

@sebasslash sebasslash merged commit 1f8a1e5 into main Oct 21, 2022
@sebasslash sebasslash deleted the user-email-search-orgmemberships branch October 21, 2022 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants