github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/terraform/version.go (about)

     1  package terraform
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/hashicorp/go-version"
     7  )
     8  
     9  // The main version number that is being run at the moment.
    10  const Version = "0.9.5"
    11  
    12  // A pre-release marker for the version. If this is "" (empty string)
    13  // then it means that it is a final release. Otherwise, this is a pre-release
    14  // such as "dev" (in development), "beta", "rc1", etc.
    15  const VersionPrerelease = "dev"
    16  
    17  // SemVersion is an instance of version.Version. This has the secondary
    18  // benefit of verifying during tests and init time that our version is a
    19  // proper semantic version, which should always be the case.
    20  var SemVersion = version.Must(version.NewVersion(Version))
    21  
    22  // VersionHeader is the header name used to send the current terraform version
    23  // in http requests.
    24  const VersionHeader = "Terraform-Version"
    25  
    26  func VersionString() string {
    27  	if VersionPrerelease != "" {
    28  		return fmt.Sprintf("%s-%s", Version, VersionPrerelease)
    29  	}
    30  	return Version
    31  }