Skip to content
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

Logging and Output to Determine Installed Terraform CLI Version #143

Open
bflad opened this issue Dec 21, 2021 · 1 comment
Open

Logging and Output to Determine Installed Terraform CLI Version #143

bflad opened this issue Dec 21, 2021 · 1 comment

Comments

@bflad
Copy link
Contributor

bflad commented Dec 21, 2021

Version

v1.3.2 (current v1)

Description

When using a non-pinned constraint, e.g.

    - uses: hashicorp/setup-terraform@v1
      with:
        terraform_version: '1.1.*'

This action does not provide any indication of the actually installed Terraform CLI version. This can make debugging more difficult, especially in matrix-based testing.

Workaround

Manually run terraform version as its own command.

    - uses: hashicorp/setup-terraform@v1
      with:
        terraform_version: ${{ matrix.terraform }}
        terraform_wrapper: false
    - run: terraform version

In the Actions UI:

Terraform v1.1.2
on linux_amd64

Proposals

A first proposal would be to have the action automatically run terraform version (potentially with the -json flag where supported) and informationally log the command's output. This has the added benefit of always showing the version regardless of other workflow configuration and verifying the install upfront.

A second proposal would be to further handle the terraform version output by parsing it to extract the actual version, then saving that as an action output (e.g. terraform_version or cli_version). This would allow downstream steps to either output the version manually or use that version for further logic.

References

@iiro
Copy link

iiro commented May 20, 2022

A very good idea @bflad!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants