Last active
April 16, 2018 11:35
-
-
Save l2fprod/25bca339cedee83e4c3ca54e431eca46 to your computer and use it in GitHub Desktop.
Run terraform and the IBM Cloud provider in DevOps toolchain
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
#!/bin/bash | |
# get the latest terraform | |
curl -LO "https://releases.hashicorp.com/terraform/$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')/terraform_$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')_linux_amd64.zip" | |
unzip terraform*.zip | |
rm -f terraform*.zip | |
chmod 755 terraform | |
./terraform version | |
# get the latest IBM Cloud provider | |
curl -LO $(curl -I https://github.com/IBM-Cloud/terraform-provider-ibm/releases/latest | grep Location | awk '{print $2}' | sed 's/tag/download/g' | tr -d '[:space:]')/linux_amd64.zip | |
unzip linux_amd64.zip | |
rm -f linux_amd64.zip | |
mv terraform-provider-ibm /home/pipeline | |
# declare the provider | |
echo 'providers { | |
ibm = "/home/pipeline/terraform-provider-ibm" | |
}' > ~/.terraformrc | |
# from here you can use terraform + ibm provider | |
./terraform init |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment