• Jake Champlin's avatar
    core: Use environment variables to set VersionPrerelease at compile time · bd687890
    Jake Champlin authored
    Instead of using a hardcoded version prerelease string, which makes release automation difficult, set the version prerelease string from an environment variable via the go linker tool during compile time.
    
    The environment variable `TF_RELEASE` should only be set via the `make bin` target, and thus leaves the version prerelease string unset. Otherwise, when running a local compile of terraform via the `make dev` makefile target, the version prerelease string is set to `"dev"`, as usual.
    
    This also requires some changes to both the circonus and postgresql providers, as they directly used the `VersionPrerelease` constant. We now simply call the `VersionString()` function, which returns the proper interpolated version string with the prerelease string populated correctly.
    
    `TF_RELEASE` is unset:
    
    ```sh
    $ make dev
    ==> Checking that code complies with gofmt requirements...
    go generate $(go list ./... | grep -v /terraform/vendor/)
    2017/05/2...
    bd687890