actionshub/terraform-lint

Allow us to define to which terraform version run

Opened this issue · 4 comments

🗣️ Foreword

:person_frowning: Problem Statement

The current release use the latest terraform version for lint check, we have a lot of code under 0.12 version , running fmt with 0.14 fail.

❔ Possible Solution

allow user choose terraform version to be checked

⤴️ Describe alternatives you've considered

passing version as tag arg or create branchs for different terraform release eg tf12 , tf13, (tf14)

➕ Additional context

conzy commented

Encountering same issue today. Because the Dockerfile in the project does not specify a tag: FROM hashicorp/terraform even though I have pinned this Action @ 1.0.0 I have been hit by a breaking change. Presumably because hashicorp/terraform:latest was updated to Terraform 14 yesterday

So it looks like this will mean a fundamental rewrite of the action as it appears docker does not support the dynamic selection of image.

I will look into how to do this soon, though I aim not to change how you all interact with it except to add some parameter which will allow you to select the version.

On a side note does anyone have documentation of a way of installing the latest or a selected version of terraform dynamically?

Thanks!

On a side note does anyone have documentation of a way of installing the latest or a selected version of terraform dynamically?

maybe we can use https://github.com/tfutils/tfenv or https://hub.docker.com/r/hashicorp/terraform/dockerfile

So I've finally got back around to this (sorry about how long) and github actions still does not support dynamic from: in Dockerfile so I'm trying to work out if we want to add complexity to this or not in order to meet this requirement.

I will do some testing to find out if using tfenv is faster than pulling from dockerhub or not and make a decision based on the outcome of that (I know that Dockerfile based runs are not exactly fast after all)