2015-08-18 20:09:15 +02:00
|
|
|
# Building Terraform
|
2015-05-26 23:12:44 +02:00
|
|
|
|
2019-10-12 02:28:54 +02:00
|
|
|
This document contains details about the process for building release-style
|
|
|
|
binaries for Terraform.
|
|
|
|
|
|
|
|
(If you are intending instead to make changes to Terraform and build binaries
|
|
|
|
only for your local testing, see
|
|
|
|
[the contributing guide](.github/CONTRIBUTING.md).)
|
2015-05-26 23:12:44 +02:00
|
|
|
|
|
|
|
## Versioning
|
|
|
|
|
2019-10-12 02:28:54 +02:00
|
|
|
Until Terraform v1.0, Terraform's versioning scheme is as follows:
|
|
|
|
|
|
|
|
* Full version strings start with a zero in the initial position.
|
|
|
|
* The second position increments for _major_ releases, which may contain
|
|
|
|
backwards incompatible changes.
|
|
|
|
* The third and final position increments for _minor_ releases, which
|
|
|
|
we aim to keep backwards compatible with prior releases for the same major
|
|
|
|
version.
|
2015-05-26 23:12:44 +02:00
|
|
|
|
2019-10-12 02:28:54 +02:00
|
|
|
Although the Terraform team takes care to preserve compatibility between
|
2019-11-18 00:04:22 +01:00
|
|
|
major releases, major release upgrades will often require a subset of users
|
|
|
|
to take specific upgrade actions. This issue will persist while the product
|
|
|
|
design is refined in preparation for more specific backward-compatibility promises
|
2019-10-12 02:28:54 +02:00
|
|
|
in a later Terraform 1.0 release.
|
2015-05-26 23:12:44 +02:00
|
|
|
|
|
|
|
## Process
|
|
|
|
|
2019-10-12 02:28:54 +02:00
|
|
|
Terraform release binaries are built via cross-compilation on a Linux
|
|
|
|
system, using [gox](https://github.com/mitchellh/gox).
|
2015-08-18 20:09:15 +02:00
|
|
|
|
2019-10-12 02:28:54 +02:00
|
|
|
The steps below are a subset of the steps HashiCorp uses to prepare the
|
|
|
|
official distribution packages available from
|
|
|
|
[the download page](https://www.terraform.io/downloads.html). This
|
|
|
|
process will generate an executable for each of the supported target platforms.
|
2015-08-18 20:09:15 +02:00
|
|
|
|
2019-10-12 02:28:54 +02:00
|
|
|
HashiCorp prepares release binaries on Linux amd64 systems. This build process
|
|
|
|
may need to be adjusted for other host platforms.
|
2015-05-26 23:12:44 +02:00
|
|
|
|
|
|
|
```sh
|
2015-08-18 20:09:15 +02:00
|
|
|
# clone the repository if needed
|
|
|
|
git clone https://github.com/hashicorp/terraform.git
|
|
|
|
cd terraform
|
|
|
|
|
2019-10-12 02:28:54 +02:00
|
|
|
# Verify that the unit tests are passing
|
2015-05-26 23:12:44 +02:00
|
|
|
make test
|
|
|
|
|
2019-10-12 02:28:54 +02:00
|
|
|
# Run preparation steps and then build the executable for each target platform
|
|
|
|
# in the subdirectory "pkg".
|
2015-08-18 20:09:15 +02:00
|
|
|
# This generates binaries for each platform and places them in the pkg folder
|
2016-02-20 00:57:39 +01:00
|
|
|
make bin
|
2015-08-18 20:09:15 +02:00
|
|
|
```
|
|
|
|
|
2019-10-12 02:28:54 +02:00
|
|
|
Official releases are subsequently then packaged, hashed, and signed before
|
|
|
|
uploading to [the HashiCorp releases service](https://releases.hashicorp.com/terraform/).
|
|
|
|
Those final packaging steps are not fully reproducible using the contents
|
|
|
|
of this repository due to the use of HashiCorp's private signing key. However,
|
|
|
|
you can place the generated executables in `.zip` archives to produce a
|
|
|
|
similar result without the checksums and digital signature.
|
2015-08-18 20:09:15 +02:00
|
|
|
|
2019-10-12 02:28:54 +02:00
|
|
|
## Release Bundles for use in Terraform Enterprise
|
2015-08-18 20:09:15 +02:00
|
|
|
|
2019-10-12 02:28:54 +02:00
|
|
|
If you wish to build distribution archives that blend official Terraform
|
|
|
|
release executables with a mixture of official and third-party provider builds,
|
|
|
|
see [the `terraform-bundle` tool](tools/terraform-bundle).
|