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
[Feature Request] Support for terraform login
credentials
#146
Comments
This would be great! |
Is this related to #111 in how credentials are retrieved? |
@tristanmorgan I think |
My poorly worded comment was more about how the TFE provider should use the same code for storage and retrieval of tokens as the login in terraform cli. similar to this issue in the provider for Vault. |
Gotcha. I don’t disagree with you there. |
Hey guys, they are related and have the same solution. https://github.com/bendrucker/terraform-credentials-keychain Here's an example of using the https://github.com/bendrucker/terraform-cloud-cli/blob/master/cmd/meta.go#L30-L72 That ends up invoking the credential helper as long as you don't have statically defined token for that host. Terraform is versioned as a CLI and not a library, so there are no versioning guarantees around those packages. There may be some hesitation from the maintainers around re-introducing that coupling now that I don't have a pressing personal need for this feature but I'm happy to provide feedback on a PR. |
This provider already supports .terraformrc - it should be trivial to upgrade it to support the $HOME/.terraform.d/credentials.tfrc.json file. The file parsing logic is here: This would just need to be split into two file provider types, one that parses HCL, one JSON. The lookup logic is in these two files: I'd suggest we want to set the order of residence as credentials.tfrc.json BEFORE .terraformrc Then finally just update the docs with the new lookup. I won't get a chance to look at this in the next week, but seems relatively easy for somebody else to pickup. In the interim, I'd suggest tracking the credential helper convo in the other thread linked #111 |
After a quick look at that code I thought it worth trying this as a workaround, and it seems to be working working with the TFE provider after a couple of different tests. export TERRAFORM_CONFIG=/Users/grant/.terraform.d/credentials.tfrc.json |
Terraform 0.12.21 added a terraform login command which populates credentials at
$HOME/.terraform.d/credentials.tfrc.json
(not sure if the Windows Path differs). It would be great if the TFE provider could pick up those credentials automatically in addition to the currently supported methods of theTFE_TOKEN
environment variable and the CLI config file.The text was updated successfully, but these errors were encountered: