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
Support BROWSER environment variable for overriding how "terraform login" launches a web browser #34902
Comments
Thanks for this feature request! If you are viewing this issue and would like to indicate your interest, please use the 👍 reaction on the issue description to upvote this issue. We also welcome additional use case descriptions. Thanks again! |
@crw - i have a PR which works |
Hi @michaelbrewer, Terraform aims to outsource the general problem of launching a browser to the upstream library Could you try making this feature request upstream first? If the upstream maintainer is willing to include this additional heuristic then I expect we'd be happy to upgrade to a newer version with it implemented, and that would be preferable to having special extra logic in Terraform that may not be appropriate on all platforms where Terraform runs. If the upstream maintainer is not interested in supporting this then we could consider doing it here in Terraform instead, but I assume they are more familiar with this problem than we are and so I would be interested to hear their reasons for rejecting it so we can decide whether they apply to Terraform too, or whether it's worth us making an exception. |
It's not a native browser, just that remote development environments would set a standard BROWSER variable to point to shell to run and open the url. Other tools support this in a similar way like britive cli. Terraform is a cloud enablement tool. So it makes sense to support CDEs and Remote shells and remote development environments. |
Also note, the golang package has not accepted new contributions for a while. In fact there are a number forks |
I expect we would also be willing to switch to an actively-maintained fork, particularly if it offered equivalent functionality plus the additional environment variable you want. I do see pkg/browser#41 open in the current library where there was some debate about this idea already, and an earlier PR pkg/browser#14 where it was already declined, so it seems like either way this particular maintainer declined to support this, and some plausible reasons against supporting it, but it seems like the concern was about it not being well-specified yet, which seems like a problem that could be solved if a fork maintainer were sufficiently motivated. If this were something we were to implement inline in Terraform then I expect we'd choose to use a Terraform-specific environment variable (which conventionally have a |
But hack i can tell our fiserv associates is to install a fake #!/usr/bin/bash
$BROWSER "$1"; But that does not feel right |
Yes as in comment pkg/browser#41 (comment) most people are having to come up with a workaround like the patch i made. |
So either we patch terraform with I mean again we could hack TF_BROWSER=$BROWSER |
The main challenge with following the lead of other implementations is that unless we're compatible with what those other implementations expect then we've made things harder rather than easier, because it'll become necessary to reset I proposed a If we can figure out some consensus on exactly how Do you know if any of the other software you care about that uses this environment variable happens to be written in Go? Perhaps we could collaborate with them on extracting their existing implementation into a shared library, if so. If we do end up with a separate implementation of this (rather than it being encapsulated in the browser library we already depend on) then I think it would be best to implement it as conditionally assigning a different implementation of the existing interface to |
@apparentlymart is this what you mean ? Which added a flag to use the browser environment variable to launch the browser ( |
@apparentlymart i have to PRs with different implementations to choose from |
@michaelbrewer Just FYI we will be discussing this in triage on Monday. Thanks! |
@crw any updates? hopefully the use case makes sense. |
Yes, this is to be reviewed. I think this week got a little busy with the 1.8 GA release, but I've put it back on the radar. |
@crw any updates? |
No, I bumped it again. I may need to get this re-prioritized. Thanks for checking in. |
Terraform Version
Terraform Configuration Files
N/A
Debug Output
N/A
Expected Behavior
Terraform login should use the
BROWSER
environment variable to find alternatives to open the login window on remote developer environments.Here is example code of how this is achieved in the
coder login
cliActual Behavior
Currently terraform login falls back to the lynx browser
Steps to Reproduce
terraform login on a remote environment like gitpod, coder or codespace within a VSCode web or desktop terminal.
Additional Context
NA
References
$BROWSER
environment variable when set to open browser window #34904 (via support ofBROWSER
env only)TF_BROWSER_ENV
env flag)The text was updated successfully, but these errors were encountered: