atmos
atmos copied to clipboard
For non-geodesic users, allow `command` templates or auto search for popular directory formats
Describe the Feature
Currently we can use hard coded values
components:
abc:
command: "/bin/terraform-1"
This works if you're using geodesic or nix or similar but it doesn't work if devs want to use native binaries.
The native binaries may be installed via asdf or tfenv or tfswitch.
- asdf
/Users/user/.asdf/installs/terraform/{version}/bin/terraform - tfenv
/home/user/.tfenv/versions/{version}/terraform - tfswitch
/home/user/.terraform.versions/terraform_{version}
Expected Behavior
An improved templating system
Use Case
Allow using asdf, tfsec, tfenv or any terraform version manager by supplying command templates. This also removes hard coding binaries in the yaml leaving only the input that matters which is the version.
Describe Ideal Solution
It would be nice in atmos.yaml to allow adding formats to check for
terraform:
command_templates:
- "/Users/user/.asdf/installs/terraform/{version}/bin/terraform"
- "/home/user/.tfenv/versions/{version}/terraform"
- "/home/user/.terraform.versions/terraform_{version}"
then for components, we can use something like this
components:
abc:
# should resolve to latest binary installed locally if available
# e.g. `/Users/user/.asdf/installs/terraform/1.6.2/bin/terraform`
command_version: "1"
# should resolve to latest binary installed locally if available
# e.g. `/Users/user/.asdf/installs/terraform/1.5.7/bin/terraform`
command_version: "1.5"
# should resolve to exact binary installed locally if available
# e.g. `/Users/user/.asdf/installs/terraform/1.6.2/bin/terraform`
command_version: "1.6.2"
Alternatives Considered
No response
Additional Context
No response
@nitrocode why not just write:
components:
abc:
command: "terraform"
Then it should use your search path, and be compatible with tools like asdf
The way asdf works is by auto switching to the tool version using a direnv-like .tool-versions file within a directory.
This file can be added in the components/terraform/abc/.tool-versions by doing the following
asdf plugin add terraform
asdf install terraform 1.2.3
cd components/terraform/abc
asdf local terraform 1.2.3
✗ cat .tool-versions
terraform 1.2.3
But then you have an issue if you have multiple instantiations of abc that use different terraform versions.
components:
abc:
command: "terraform"
components:
abc/legacy:
command: "terraform0.12"
Today, we can do explicitly set these but then it's only compatible with a single tool asdf or tfenv or tfswitch due to the path structure.
components:
abc:
command: /Users/user/.asdf/installs/terraform/1.6.2/bin/terraform
components:
abc/legacy:
command: /Users/user/.asdf/installs/terraform/0.12.5/bin/terraform