-
Notifications
You must be signed in to change notification settings - Fork 56
Building Terraform
Below version of Terraform is available in respective distribution at the time of creation of these build instructions:
- SLES 15 (SP3, SP4) have
0.13.4
The instructions provided below specify the steps to build Terraform 1.2.5 on Linux on IBM Z for following distributions:
- RHEL (7.8, 7.9, 8.4, 8.5, 8.6, 9.0)
- SLES (12 SP5, 15 SP3, 15 SP4)
- Ubuntu (18.04, 20.04, 22.04)
General Notes:
- When following the steps below please use a standard permission user unless otherwise specified.
- A directory
/<source_root>/
will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.
If you want to build terraform using manual steps, go to STEP 2.
Use the following commands to build terraform using the build script. Please make sure you have wget installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Terraform/1.2.5/build_terraform.sh
# Build terraform
bash build_terraform.sh [Provide -t option for executing build with tests]
In case of error, check logs
for more details or go to STEP 2 to follow manual build steps.
export SOURCE_ROOT=/<source_root>/
-
RHEL (7.8, 7.9, 8.4, 8.5, 8.6, 9.0)
sudo yum install -y git wget tar gcc diffutils
-
SLES (12 SP5, 15 SP3, 15 SP4)
sudo zypper install -y git-core wget tar gcc gzip
-
Ubuntu (18.04, 20.04, 22.04)
sudo apt-get update sudo apt-get install -y git wget tar gcc
-
Install git version greater than 2.3.0 (only for rhel 7.x)
sudo yum install -y make curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker sudo yum remove -y git wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz gunzip git-2.9.5.tar.gz tar -xvf git-2.9.5.tar cd git-2.9.5 sudo make prefix=/usr/local/git all sudo make prefix=/usr/local/git install export PATH=$PATH:/usr/local/git/bin
- Install Go version
1.17.2
cd $SOURCE_ROOT wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Go/1.18.4/build_go.sh bash build_go.sh -v 1.17.2
#Download and install terraform
export GOPATH=$SOURCE_ROOT
export PATH=$GOPATH/bin:$PATH
mkdir -p $GOPATH/src/github.com/hashicorp
cd $GOPATH/src/github.com/hashicorp
git clone https://github.com/hashicorp/terraform.git
cd terraform
git checkout v1.2.5
go install .
The terraform
binary will be created in folder $GOPATH/bin/
-
Copying binary to /usr/bin and verify installation
sudo cp $GOPATH/bin/terraform /usr/bin/ terraform -version terraform -help
cd $GOPATH/src/github.com/hashicorp
go test ./...
Note: In case of unexpected test failures, please try re-running the test individually. Use below command to execute the test individually:
go test -v <package_name> -run <failed_test_name>
The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue or contact us on IBM Z Community if you have any questions or feedback.