-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add documentation on Terraform's available build options
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 with required options. | ||
|
||
## 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. | ||
|
||
### `github.com/hashicorp/terraform/version.useDevelopmentVersion` | ||
|
||
Terraform will include a `-dev` flag when reporting its own version (ex: 1.5.0-dev) unless this option is set to `no`: | ||
|
||
``` | ||
go build -ldflags "-w -s -X 'github.com/hashicorp/terraform/version.useDevelopmentVersion=no'" -o bin/ . | ||
``` | ||
|
||
### `main.experimentsAllowed` | ||
|
||
Experimental features of Terraform will be disabled unless this option 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 given operating system and processor architecture. | ||
|
||
|