terraform/builtin/providers/postgresql
Jake Champlin bd68789006
core: Use environment variables to set VersionPrerelease at compile time
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/22 10:38:19 Generated command/internal_plugin_list.go
==> Removing old directory...
==> Building...
Number of parallel builds: 3

-->     linux/amd64: github.com/hashicorp/terraform

==> Results:
total 209M
-rwxr-xr-x 1 jake jake 209M May 22 10:39 terraform

$ terraform version
Terraform v0.9.6-dev (fd472e4a86500606b03c314f70d11f2bc4bc84e5+CHANGES)
```

`TF_RELEASE` is set (mimicking the `make bin` target):

```sh
$ TF_RELEASE=1 make dev
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/22 10:40:39 Generated command/internal_plugin_list.go
==> Removing old directory...
==> Building...
Number of parallel builds: 3

-->     linux/amd64: github.com/hashicorp/terraform

==> Results:
total 121M
-rwxr-xr-x 1 jake jake 121M May 22 10:42 terraform

$ terraform version
Terraform v0.9.6
```
2017-05-22 10:49:15 -04:00
..
.gitignore provider/postgres: Ignore temporary Postgres data 2016-12-27 15:13:27 -06:00
GNUmakefile Add an Exists function for each resource type. Also add a provider RWMutex. 2016-12-27 15:50:25 -08:00
config.go Audit all call sites where `fmt.Errorf()` was being used and switch to errwrap. 2016-12-27 15:50:25 -08:00
helpers.go Fix up helpers. 2016-12-12 14:30:25 -08:00
provider.go core: Use environment variables to set VersionPrerelease at compile time 2017-05-22 10:49:15 -04:00
provider_test.go Remove the PGPASSWORD requirement for tests. 2016-12-10 12:32:17 +11:00
resource_postgresql_database.go improve error message 2017-01-27 01:50:45 +01:00
resource_postgresql_database_test.go gofmt cleanup on imports. 2016-12-12 15:21:20 -08:00
resource_postgresql_extension.go Use `fmt.Fprint()` instead of `Fprintf()`. 2016-12-27 15:50:25 -08:00
resource_postgresql_extension_test.go Add the version attribute to postgresql_extension. 2016-12-12 14:37:40 -08:00
resource_postgresql_role.go Follow up to #11161 to fix `connection_limit` updates to a ROLE. 2017-01-11 16:24:00 -08:00
resource_postgresql_role_test.go provider/postgresql: Fix failing acceptance test (#11375) 2017-01-24 14:10:56 +02:00
resource_postgresql_schema.go Add an Exists function for each resource type. Also add a provider RWMutex. 2016-12-27 15:50:25 -08:00
resource_postgresql_schema_test.go Before revoking a privilege from a schema, check to ensure role exists. 2016-12-25 06:13:34 -08:00