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

Provide a link to the latest release of terraform #9803

Closed
ColinHebert opened this issue Nov 2, 2016 · 11 comments
Closed

Provide a link to the latest release of terraform #9803

ColinHebert opened this issue Nov 2, 2016 · 11 comments
Labels
build Auto-pinning

Comments

@ColinHebert
Copy link
Contributor

Currently https://releases.hashicorp.com/terraform/ presents a list of every version of terraform ever released.

It would be nice to be able to get the latest version available (released) from https://releases.hashicorp.com/terraform/latest/ with a full link such as https://releases.hashicorp.com/terraform/latest/ terraform_latest_freebsd_amd64.zip

I know not everyone wants to rely on this behaviour, but it helps to be able to point to the latest version and leave the responsibility of making sure the version is the expected one to the user.

@stack72 stack72 added the build Auto-pinning label Nov 2, 2016
@sethvargo
Copy link
Contributor

sethvargo commented Nov 2, 2016

Hey @ColinHebert

Thank you for opening an issue. You might not recognize my name, since I'm not involved in the day-to-day workings of Terraform. One of my responsibilities is to manage the HashiCorp releases service, and Paul asked me to take a look at this issue.

In short, we intentionally do not provide a pointer to the "latest" version of any of our software downloads. This was a very intentional and very deliberate choice, and I'd would like to explain the reasoning. As part of the Tao of HashiCorp, we believe in Versioning through Codification and Automation through Codification. These two concepts are key in building a successful and sustainable platform. It is highly discouraged that you "ride the latest version" of any software package, not just HashiCorp. It is important to note that this is not a reflection of the quality of the software or release; it is a property of a well-built system. At any point in time, you should be able to reproduce a build. Using a remote URL whose target changes voids the possibility of having a reproducible build. We do not advocate downloading the latest version of Terraform (or any HashiCorp software), and encourage users to pick a version and then coordinate an upgrade effectively.

In case you are unaware, the HashiCorp Releases Service features a full JSON API which provides machine-parsable version information. Here is a quick jq that would let you download the latest version of Terraform, but you should be strongly advised that we do not recommend this.

echo "https://releases.hashicorp.com/terraform/$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')/terraform_$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')_darwin_amd64.zip"

Right now, that will return "0.7.8".

@ColinHebert
Copy link
Contributor Author

ColinHebert commented Nov 2, 2016

I agree with the sentiment of avoiding blind upgrades. In this case the process we're following is this one:

  • Download the latest version of each of the pieces of software we need (in a docker image/AWS ami/Whatnot)
  • Run a series of tests against the generated image ensuring that the version we're using is the expected one (ie, a serverspec test ensuring that the "latest" version we expect is 0.7.7, etc.).
  • In case of software update, there will be a build failure; the expected latest version needs to be updated in the test suite (ie. look at the changelogs, diffs, approve the new version).

The build process is executed automatically on a regular basis. Any upgrade of the "latest" version of anything we use ends up in an expected build failure.
This ensures that we're keeping our everything up to date (security updates, bugfixes, etc.).
Each update is notifying us automatically (as our build breaks, on purpose) which avoids having to keep track of multiple projects moving at different speed (push vs poll).
In case of unacceptable release (bugged release, etc.) it is possible to pin temporarily to a version of our choice.

Obviously the entire process relies on being able to easily access the latest version of any software.

@alex-harvey-z3q
Copy link
Contributor

alex-harvey-z3q commented Jul 12, 2017

By the way, while we're on the subject of preaching best practices to your customers; when is HashiCorp going to provide a unit testing framework for Terraform?

@sethvargo
Copy link
Contributor

sethvargo commented Jul 12, 2017

Hi @alexharv074

Thank you for your feedback. I replied on the Packer issue to your first comment. We do not have plans to provide a unit test framework for Terraform at this time.

@polvoazul
Copy link

Also, is there a reason not to provide real yum/apt packages? I would like to understand the design decision behind it.

@nodesocket
Copy link

For those that are interested, I created a simple bash script that attempts to be a HashiCorp package manager called hashipm. hashipm automatically determines your operating system and architecture and downloads and installs the latest version of nearly all HashiCorp packages (Consul, Nomad, Packer, Terraform, Vault) into /usr/local/bin or /usr/bin.

An example using hashipm to install Terraform:

➜ hashipm get terraform
Downloading terraform (0.11.7) from https://releases.hashicorp.com/terraform/0.11.7/terraform_0.11.7_darwin_amd64.zip...
Installed terraform (0.11.7) into /usr/local/bin

See the GitHub repo at https://github.com/elasticbyte/hashipm

@sethvargo
Copy link
Contributor

That's not doing any kind of GPG or checksum validation. I'd recommend just using something simple like I did in this gist instead...

@nodesocket
Copy link

nodesocket commented Apr 19, 2018

@sethvargo I have an open issue to do checksum validation if you'd like to contribute 😃 Your gist script is nice, but does not automagically handle detecting the latest version, operating system, and architecture like hashipm. Also, I believe the mv into /usr/local/bin will require sudo typically.

elasticbyte/hashipm#1

@hoto
Copy link

hoto commented Dec 15, 2018

Thanks for that link https://checkpoint-api.hashicorp.com/v1/check/terraform to get the latest version id.

My ansible role to get latest terraform if anyone come here from google.

- name: get latest terraform version id
  uri:
    url: 'https://checkpoint-api.hashicorp.com/v1/check/terraform'
    method: GET
    status_code: 200
    timeout: 10
  register: release

- set_fact:
    version: "{{ release.json | json_query('current_version') }}"

- name: terraform is present
  get_url:
    url: 'https://releases.hashicorp.com/terraform/{{ version }}/terraform_{{ version }}_linux_amd64.zip'
    dest: '/tmp/terraform.zip'

@zioalex
Copy link

zioalex commented Aug 28, 2019

Thanks for that link https://checkpoint-api.hashicorp.com/v1/check/terraform to get the latest version id.

My ansible role to get latest terraform if anyone come here from google.

- name: get latest terraform version id
  uri:
    url: 'https://checkpoint-api.hashicorp.com/v1/check/terraform'
    method: GET
    status_code: 200
    timeout: 10
  register: release

- set_fact:
    version: "{{ release.json | json_query('current_version') }}"

- name: terraform is present
  get_url:
    url: 'https://releases.hashicorp.com/terraform/{{ version }}/terraform_{{ version }}_linux_amd64.zip'
    dest: '/tmp/terraform.zip'

@hoto can you please share how to use such ansible piece?

@ghost
Copy link

ghost commented Aug 29, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Aug 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build Auto-pinning
Projects
None yet
Development

No branches or pull requests

8 participants