Christian Winther
05/03/2024, 4:27 PM`go-getter`'sAny reason why we can't tweakis then used to get the binary. This is broken with TFGetFileas a License.txt file is also included>= 1.8.2
go-getter usage to deal with multiple files?
I like hc-install and use it a lot of our internal tooling; just curious if tweaking existing go-getter usage to not care about extra files (of any kind) and keeping the code usable between TF and Tofu wouldn't be a bigger net benefit?
1. Grab zip
2. Extract the zip to tmp dir
3. Expect a file named terraform or tofu in the tmp dir
4. Copy that binary file into place
5. Wipe the tmp directory
any future zip file changes or additional files would be ignored 🙂James Brookes
05/03/2024, 4:40 PMGetAny - https://github.com/runatlantis/atlantis/pull/4478
• PR to add OpenTofu support - https://github.com/runatlantis/atlantis/pull/4499
This comment seems to suggest that a possible goal is to remove the "package-manager" aspect from Atlantis.
• Current usage: Use terraform-switcher lib to get all available TF versions, put them into slice, sort, cycle through checking versions against constraint
• Proposed hc-install usage: Let hc-install determine the version to download, and also let it download it
The hc-install approach has the benefit of eliminating other areas (such as getting a list of all TF versions, manually checking constraints for it) - it doesn't just touch the download/unzip part.
It also wouldn't be a 1-1 mapping of logic between TF vs OpenTofu - the WP PR for OpenTofu support needs completely different logic to "fetch" the list of available versions as there is not support for it in warrensbox/terraform-switcher - https://github.com/runatlantis/atlantis/blob/df1dbbad11b0413e0f204394bf16b4ed2c52a214/server/core/terraform/terraform_client.go#L690-L725
If we kept the current implementation for TF and Tofu, the only thing that would be kept the same is the downloading/unzipping the ZIP file I believe?Christian Winther
05/03/2024, 4:44 PMtfenv or similar into the Atlantis image instead for convenienceChristian Winther
05/03/2024, 4:45 PMChristian Winther
05/03/2024, 4:50 PMJames Brookes
05/03/2024, 4:51 PMChristian Winther
05/03/2024, 4:52 PMChristian Winther
05/03/2024, 4:53 PMcustom-url effectively being frozen to 1.8.1 or lower with hc-install, I would lean towards fixing it with go-getter so both official and custom download URLs will continue to workJames Brookes
05/03/2024, 4:56 PMhc-install PR goes ahead, go-getter usage will need to be changed to GetAny instead of GetFile like in the draft PR to unblock >=1.8.2Christian Winther
05/03/2024, 4:56 PMTF hc-install, TF go-getter custom + Tofu go-getter otherwiseChristian Winther
05/03/2024, 4:59 PMJames Brookes
05/03/2024, 4:59 PMhc-install and add support for custom URL and/or OpenTofu support 🤔 (outside scope of Atlantis, just curious)
But yeah, I think sorting go-getter to work with 1.8.2 should be done first and evaluate from there maybe?PePe Amengual
05/03/2024, 4:59 PMremove TF package manager of atlantis is still a conversation we need to decide on but there are a few of us that think it will be better in the long term @Luke Massa @RB @Rui @Dylan PageJames Brookes
05/03/2024, 5:59 PMRB
05/03/2024, 6:05 PMhc-install is created and maintained by hashicorp (call me cynical), if opentofu is getting downloaded through that pipe, it would be fairly easy for them to “break” it by mistakeRB
05/03/2024, 6:05 PMJames Brookes
05/03/2024, 6:17 PMgo-getter for custom URL downloads of TF, just for Tofu) - https://atlantis-community.slack.com/archives/C04ES70Q6E8/p1714755412078889?thread_ts=1714753649.673719&cid=C04ES70Q6E8James Brookes
05/10/2024, 1:20 PM