-
Notifications
You must be signed in to change notification settings - Fork 160
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
allow TF_TOKEN_... variables to specify host-specific credentials #477
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌟 Tested and verified locally and it works!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks fuego 🔥 👍 -- Last thing would be to update the Authentication
section in this file: https://github.com/hashicorp/terraform-provider-tfe/blob/main/website/docs/index.html.markdown
|
||
ret := make(map[svchost.Hostname]string) | ||
for _, ev := range os.Environ() { | ||
eqIdx := strings.Index(ev, "=") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious here on readability: Would it be better to strings.Split()
on =
and compare each index rather than using ranges ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split might be slightly more readable, but this version doesn't do any array allocation and is shared with terraform already. I think I'd like to keep it.
@sebasslash I added the docs. Good call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Description
This is a companion PR to a change to terraform that adds host specific env svc creds. It should be possible for tfe to use the same method when specifying credentials for a particular tfc host.
Testing plan
go build -o terraform-provider-tfe
and update your CLI config to override it (see below)I used this config:
with this command:
TF_CLI_CONFIG_FILE=.terraformrc TF_TOKEN_YOURHOST_COM="MY_REAL_TOKEN" terraform apply
with this CLI config:
External links