2017-10-20 01:08:35 +02:00
|
|
|
// The version package provides a location to set the release versions for all
|
|
|
|
// packages to consume, without creating import cycles.
|
|
|
|
//
|
2018-06-10 02:27:53 +02:00
|
|
|
// This package should not import any other terraform packages.
|
2017-10-20 01:08:35 +02:00
|
|
|
package version
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
version "github.com/hashicorp/go-version"
|
|
|
|
)
|
|
|
|
|
|
|
|
// The main version number that is being run at the moment.
|
2021-06-02 20:47:27 +02:00
|
|
|
var Version = "1.1.0"
|
2017-10-20 01:08:35 +02:00
|
|
|
|
|
|
|
// A pre-release marker for the version. If this is "" (empty string)
|
|
|
|
// then it means that it is a final release. Otherwise, this is a pre-release
|
|
|
|
// such as "dev" (in development), "beta", "rc1", etc.
|
2021-02-10 19:00:31 +01:00
|
|
|
var Prerelease = "dev"
|
2017-10-20 01:08:35 +02:00
|
|
|
|
2017-10-20 03:48:08 +02:00
|
|
|
// SemVer is an instance of version.Version. This has the secondary
|
2017-10-20 01:08:35 +02:00
|
|
|
// benefit of verifying during tests and init time that our version is a
|
|
|
|
// proper semantic version, which should always be the case.
|
2018-11-14 00:51:01 +01:00
|
|
|
var SemVer *version.Version
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
SemVer = version.Must(version.NewVersion(Version))
|
|
|
|
}
|
2017-10-20 01:08:35 +02:00
|
|
|
|
|
|
|
// Header is the header name used to send the current terraform version
|
|
|
|
// in http requests.
|
|
|
|
const Header = "Terraform-Version"
|
|
|
|
|
|
|
|
// String returns the complete version string, including prerelease
|
|
|
|
func String() string {
|
2017-10-20 03:48:08 +02:00
|
|
|
if Prerelease != "" {
|
|
|
|
return fmt.Sprintf("%s-%s", Version, Prerelease)
|
2017-10-20 01:08:35 +02:00
|
|
|
}
|
2017-10-20 03:48:08 +02:00
|
|
|
return Version
|
2017-10-20 01:08:35 +02:00
|
|
|
}
|