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

Multiple versions of terraform executable in the Docker image #365

Closed
eerkunt opened this issue Sep 3, 2020 · 2 comments · Fixed by #478
Closed

Multiple versions of terraform executable in the Docker image #365

eerkunt opened this issue Sep 3, 2020 · 2 comments · Fixed by #478

Comments

@eerkunt
Copy link
Member

eerkunt commented Sep 3, 2020

Feature Request

Feature description :
Since terraform executable is required to transform the plan.out into plan.out.json, we need to have that executable lives within the Docker image. On the other hand, it is also possible that different minor versions are being used for different purposes.

Suggested Solution description ( if you have any ) :
To enable #334 and fix problems that has been reported in #363, terraform-compliance Docker image must have access to all latest versions of supported terraform minor versions within the image. Currently it is 0.12.29 and 0.13.2.

  • Have an autodetection system - if possible - to understand if the plan is created via which version of terraform. Then try to execute terraform show -json plan.out > plan.out.json command via the required version.
  • If there are no autodetection available, then try from the latest and keep trying if its failed.
  • Have a TF_VERSION (e.g. 0.12.29, 0.13.1) or TF_MINOR_VERSION (e.g. 12, 13) environment variable that can be usable to override detection mechanism.

Describe alternatives you've considered :

  1. It is also possible to download the terraform executable on the fly on a failure or if given/required version does not exist in the system.
  2. After having multiple versions of the terraform, it is also possible to have a wrapper script that will point to the right terraform executable for having a wider system usage.
@AErmie
Copy link

AErmie commented Feb 1, 2021

This is an absolutely needed feature. Case in point, I ran Terraform-Compliance in a CI/CD pipeline, which installed the latest version of Terraform; but Terraform-Compliance failed with the error...

Failed to read plan from plan file: plan file was created by Terraform 0.14.5,
but this is 0.14.4; plan files cannot be transferred between different
Terraform versions.

Being restricted to a specific version of Terraform, especially when that required version is not documented anywhere (!) is not a great user experience.

@eerkunt
Copy link
Member Author

eerkunt commented Feb 2, 2021

It looks like we need to focus on documentation, thanks for the feedback @AErmie ! 🎉

In order to unblock you with a workaround, you can just install terraform-compliance in the CI pipeline (e.g. https://github.com/terraform-compliance/github_action) and use it natively instead of running via Docker image while we are implementing this feature.

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

Successfully merging a pull request may close this issue.

2 participants