From 16ae079c223538db89599e047d7e8a15aa4929ec Mon Sep 17 00:00:00 2001 From: CJ Horton Date: Mon, 10 Apr 2023 15:57:24 -0700 Subject: [PATCH] add documentation on Terraform's available build options --- BUILDING.md | 36 ++++++++++++++++++++++++++++++++++++ version/VERSION | 2 +- version/version_test.go | 3 +++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 BUILDING.md diff --git a/BUILDING.md b/BUILDING.md new file mode 100644 index 0000000000..3c13268a1c --- /dev/null +++ b/BUILDING.md @@ -0,0 +1,36 @@ +# Building from Source + +Pre-built binaries are available for download for a variety of supported platforms through the [HashiCorp Releases website](https://releases.hashicorp.com/terraform/). + +However, if you'd like to build Terraform yourself, you can do so using the Go build toolchain and the options specified in this document. + +## Prerequisites + +1. Ensure you've installed the Go language version specified in [`.go-version`](https://github.com/hashicorp/terraform/blob/main/.go-version). +2. Clone this repository to a location of your choice. + +## Terraform Build Options + +Terraform accepts certain options passed using `ldflags` at build time which control the behavior of the resulting binary. + +### Dev Version Reporting + +Terraform will include a `-dev` flag when reporting its own version (ex: 1.5.0-dev) unless `version.dev` is set to `no`: + +``` +go build -ldflags "-w -s -X 'github.com/hashicorp/terraform/version.dev=no'" -o bin/ . +``` + +### Experimental Features + +Experimental features of Terraform will be disabled unless `main.experimentsAllowed` is set to `yes`: + +``` +go build -ldflags "-w -s -X 'main.experimentsAllowed=yes'" -o bin/ . +``` + +## Go Options + +The Terraform release process uses the Go toolchain defaults for the current operating system and processor architecture. + + diff --git a/version/VERSION b/version/VERSION index bcfbf475d5..45d114a213 100644 --- a/version/VERSION +++ b/version/VERSION @@ -1 +1 @@ -1.6.0-dev +1.6.0-alpha1 diff --git a/version/version_test.go b/version/version_test.go index f6db4e67dd..cd889b0ac9 100644 --- a/version/version_test.go +++ b/version/version_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package version import (