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

Data source for the current user/account #1315

Open
tmatilai opened this issue Apr 18, 2024 · 0 comments
Open

Data source for the current user/account #1315

tmatilai opened this issue Apr 18, 2024 · 0 comments

Comments

@tmatilai
Copy link
Contributor

Use-cases

Fetch information of the user owning the API token used with the provider.

For example when initially configuring owners for an organization, the invoker could be dynamically imported based on the email address, assuming it is the same as the organization creator and thus implicit owner. Otherwise Terraform fails to create the membership as it already exists.

Proposal

Create a data source which can be used for getting the current user. I might be able contribute, if the I get feedback that this is something which would be accepted.

Naming is of course hard. Options:

  • tfe_current_user - matching the SDK function
  • tfe_user - could be expanded later to support fetching other users (by ID) if the SDK supported it, but would then expand over two API endpoints
  • tfe_account - matching the API endpoint

Documentation:

Example usage:

data "tfe_current_user" "this" {}

output "email" {
  value = data.tfe_current_user.this.email
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant