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

Oauth Token Data Source would be very helpful #10

Closed
djaboxx opened this issue Aug 24, 2018 · 6 comments
Closed

Oauth Token Data Source would be very helpful #10

djaboxx opened this issue Aug 24, 2018 · 6 comments

Comments

@djaboxx
Copy link

djaboxx commented Aug 24, 2018

Currently, I'm having to find the Oauth Token ID outside of Terraform. It would be very helpful if this could be part of the Terraform workflow.

Having a Data Source that looks this up would solve the problem.

@svanharmelen
Copy link
Contributor

@djaboxx that is definitely something we will add in a next release!

@hcrhall
Copy link
Contributor

hcrhall commented Nov 5, 2018

Currently, I'm having to find the Oauth Token ID outside of Terraform. It would be very helpful if this could be part of the Terraform workflow.

Having a Data Source that looks this up would solve the problem.

For those who are trying to do what @djaboxx is referring to. You can use the following to get a list of valid oauth_token_ids, you can do so by running through the following:

https://www.terraform.io/docs/enterprise/api/oauth-tokens.html#list-oauth-tokens

Documentation doesn't cover how to get this information.

@svanharmelen
Copy link
Contributor

This will work, but the challenge is that the IDs are not uniquely identifiable. So if you have multiple connections it could be required to test them one by one to find the one that you need.

But for now this seems to be the only solution while we are working to improve this in the TFE backend.

@robinbowes
Copy link

Another "me too" vote.

In fact, I'd like to see data sources for most/all of the tfe provider resources.

The ones I'm specifically interested in are:

  • ssh_id
  • oauth_token_id
  • team id

@djaboxx
Copy link
Author

djaboxx commented Dec 3, 2018

This public gist is a script that I've been using to find my oauth_tokens. There may be some bugs, if there are, please let me know and I will fix. It should look by provider and username as well as just finding the first available token. While it is true that the same user could upload different VCS connections for the same provider that are tied to different permissions, that's probably somewhat rare and therefor this script should be helpful.

https://gist.github.com/djaboxx/b9cfe2b87735957af86dcdd24fac491a

I've also used this custom module, it's been very helpful.
https://github.com/HappyPathway/terraform-tfe-oauth-token

@chrisarcand
Copy link
Member

Added in #212

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

No branches or pull requests

5 participants