File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <#
2+ This Windows script is to be used to test Terraform RCs locally. It downloads
3+ and installs the given RC.
4+
5+ ./setup-provider-windows.ps1 <provider> <version>
6+
7+ Example
8+
9+ ./setup-provider-windows.ps1 rancher v3.0.0-rc1
10+
11+ If you get a cert revocation check error when running the script, curl could
12+ not identify a valid certificate to download the zip. Add --ssl-no-revoke or
13+ --insecure to the curl command and rerun. Alternatives such as white listing
14+ the download link may also work.
15+ #>
16+
17+ $PROVIDER = $args [0 ]
18+ $VERSION = $args [1 ]
19+ $VERSION_TAG = $VERSION.TrimStart (" v" )
20+
21+ $DIR = " %APPDATA%\terraform.d\plugins\terraform.local\local\${PROVIDER} \${VERSION_TAG} \windows_amd64"
22+ new-item $DIR - itemtype directory
23+
24+ write-host " Downloading zip..."
25+ $URL = " https://github.com/rancher/terraform-provider-${PROVIDER} /releases/download/${VERSION} /terraform-provider-${PROVIDER} _${VERSION_TAG} _windows_amd64.zip"
26+ echo $URL
27+ curl.exe - LO $URL - o terraform- provider- ${PROVIDER} _ ${VERSION_TAG} _windows_amd64.zip
28+
29+ write-host " Expanding zip..."
30+ Expand-Archive - Force - Path terraform- provider- ${PROVIDER} _ ${VERSION_TAG} _windows_amd64.zip - DestinationPath ${DIR} / terraform- provider- ${PROVIDER}
31+
32+ write-host " Cleaning up..."
33+ Remove-Item - Force - Path terraform- provider- ${PROVIDER} _ ${VERSION_TAG} _windows_amd64.zip
34+
35+ write-host " Terraform is ready to test!"
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- # QA has a new process to test Terraform using rcs . We will not publish rcs
3+ # QA has a new process to test Terraform using RCs . We will not publish RCs
44# onto the Terraform registry because Hashicorp could potentially block our
55# testing by being slow to publish.
66
7- # Instead, we will test using a downloaded binary from the rc . This script
7+ # Instead, we will test using a downloaded binary from the RC . This script
88# sets up the correct binary using a defined <provider> <version> to test
99# updates locally.
1010
11+ # ./setup-provider.sh <provider> <version>
12+
1113# Example
1214# ./setup-provider.sh rancher2 v3.0.0-rc1
1315
3537
3638# Download binary
3739
38- OS_PLATFORM=$( uname -sp | tr ' [:upper:] ' ' [:lower:]_' | sed ' s/x86_64/amd64/' )
39-
40- if [[ $OS_PLATFORM == " darwin" * ]]
41- then
42- OS_PLATFORM=" darwin_amd64"
43- elif [[ $OS_PLATFORM == " linux" * ]]
44- then
45- OS_PLATFORM=" linux_amd64"
46- fi
40+ OS_PLATFORM=$( uname -sp | tr ' [:upper:] ' ' [:lower:]_' | sed ' s/x86_64/amd64/' | sed ' s/i386/amd64/' | sed ' s/arm/arm64/' )
4741
4842DIR=~ /.terraform.d/plugins/terraform.local/local/${PROVIDER} /${VERSION_TAG} /${OS_PLATFORM}
4943mkdir -p $DIR
5044curl -sfL https://github.com/rancher/terraform-provider-${PROVIDER} /releases/download/${VERSION} /terraform-provider-${PROVIDER} _${VERSION_TAG} _${OS_PLATFORM} .zip | gunzip -c - > ${DIR} /terraform-provider-${PROVIDER}
5145
46+ # Mod binary
47+ chmod +x ${DIR} /terraform-provider-${PROVIDER}
48+
5249echo -e " Terraform provider ${PROVIDER} ${VERSION} is ready to test!
5350Please update the required_providers block in your Terraform config file
5451
You can’t perform that action at this time.
0 commit comments