tfswitch should accept a "--non-interactive" argument
Closed this issue · 3 comments
toralf commented
to avoid a hang in a pipeline.
The default might be to errorred out ?
jakubbujny commented
+1 here - I can try to raise PR with such functionality if maintainers are open for it?
warrensbox commented
@jakubbujny I'd be open for it
aucampia commented
as a somewhat of a hackaround I'm piping yes into tfswitch:
root@4547b3eb3246:/srv/workspace# terraform version
Terraform v1.1.6
on linux_amd64
Your version of Terraform is out of date! The latest version
is 1.1.9. You can update by downloading from https://www.terraform.io/downloads.html
root@4547b3eb3246:/srv/workspace# tfswitch
Creating directory for terraform binary at: /root/.terraform.versions
2022/04/20 19:54:16 Prompt failed ^C
root@4547b3eb3246:/srv/workspace# ^C
root@4547b3eb3246:/srv/workspace# yes | tfswitch
✔ 1.1.9
Downloading to: /root/.terraform.versions
19262029 bytes downloaded
Switched terraform to version "1.1.9"
root@4547b3eb3246:/srv/workspace# echo 1.1.2 > .terraform-version
root@4547b3eb3246:/srv/workspace# yes | tfswitch
Reading file .terraform-version
Downloading to: /root/.terraform.versions
18687805 bytes downloaded
Switched terraform to version "1.1.2"