Skip to content

Commit 16ae079

Browse files
committed
add documentation on Terraform's available build options
1 parent 11a68ea commit 16ae079

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

BUILDING.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Building from Source
2+
3+
Pre-built binaries are available for download for a variety of supported platforms through the [HashiCorp Releases website](https://releases.hashicorp.com/terraform/).
4+
5+
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.
6+
7+
## Prerequisites
8+
9+
1. Ensure you've installed the Go language version specified in [`.go-version`](https://github.com/hashicorp/terraform/blob/main/.go-version).
10+
2. Clone this repository to a location of your choice.
11+
12+
## Terraform Build Options
13+
14+
Terraform accepts certain options passed using `ldflags` at build time which control the behavior of the resulting binary.
15+
16+
### Dev Version Reporting
17+
18+
Terraform will include a `-dev` flag when reporting its own version (ex: 1.5.0-dev) unless `version.dev` is set to `no`:
19+
20+
```
21+
go build -ldflags "-w -s -X 'github.com/hashicorp/terraform/version.dev=no'" -o bin/ .
22+
```
23+
24+
### Experimental Features
25+
26+
Experimental features of Terraform will be disabled unless `main.experimentsAllowed` is set to `yes`:
27+
28+
```
29+
go build -ldflags "-w -s -X 'main.experimentsAllowed=yes'" -o bin/ .
30+
```
31+
32+
## Go Options
33+
34+
The Terraform release process uses the Go toolchain defaults for the current operating system and processor architecture.
35+
36+

version/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.6.0-dev
1+
1.6.0-alpha1

version/version_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
14
package version
25

36
import (

0 commit comments

Comments
 (0)