hashicorp / hashicorp/setup-terraform
Logging and Output to Determine Installed Terraform CLI Version
- Dominant language
- JavaScript
- Stars
- 1.6k
- Forks
- 288
- Avg merge
- 23h 21m
- Merged PRs (30d)
- 3
Description
## Version
v1.3.2 (current v1)
## Description
When using a non-pinned constraint, e.g.
```yaml
- 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.
```yaml
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: terraform version
```
In the Actions UI:
```text
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
* Related: https://github.com/hashicorp/setup-terraform/issues/130
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by inspecting the action's installation flow and how it exposes or logs GitHub Actions outputs. Reproduce the non-pinned version case from the issue, then determine whether completion should mean logging `terraform version`, exposing the parsed version as an output, or both; verify the behavior with matrix-style version inputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, javascript, terraform
- Domain
- ci-cd, devops, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100