hashicorp / hashicorp/setup-terraform

Bring back (modified) terraform-github-actions

Open
#39 13 comments 10 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
1.6k
Forks
288
Avg merge
23h 21m
Merged PRs (30d)
3

Description

Please read in full before dismissing suggestion based on the title alone.

[`terraform-github-actions`](https://github.com/hashicorp/terraform-github-actions) was justifiably obsoleted because it suffered from a few issues:
- it downloaded `terraform` over and over in every step that used it (thus causing workflows that used multiple different terraform steps to take longer than necessary)
- it was a Docker-based step, which added a slight penalty of requiring the image to be rebuild for every job.

However, the action also offered a number of benefits:
- Proper usage of `-detailed-exitcode` and other flags, status code propagation, color removal, etc when handling command output
- Built-in creation of GitHub PR comments

It made it really simple to build a PR review/approval workflow that is still challenging to build with `setup-terraform` alone (e.g. knowing when to set a step to `continue-on-error: true`, etc.).

Recent developments in the GH Actions world mean that the aforementioned issues can be addressed more elegantly today:
- `setup-terraform` exists, which can be used to handle the installation of the binary (there are also alternatives out there, starting with the fact that terraform in preinstalled on the github hosted runners, or version management utilities like [asdf](https://github.com/asdf-vm/actions) exist).
- GitHub introduced [composite run steps](https://github.blog/changelog/2020-08-07-github-actions-composite-run-steps/), which makes it easy to implement a reusable step using bash without paying the Docker cost.

My proposal is thus to bring back `terraform-github-actions` with the following changes:
- Remove the parts responsible for installing a particular version of terraform (including removing the `tf_actions_version` action argument)
- Convert the action implementation to the "composite" type (instead of Docker-based), leaving the rest of the action input/output interface intact.

This way, we can chose to use the higher-level functionality of `terraform-github-actions` or invoke terraform directly via run steps.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.