-
Notifications
You must be signed in to change notification settings - Fork 41
/
config-tf-dev-override.sh
executable file
·38 lines (34 loc) · 1.25 KB
/
config-tf-dev-override.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
set -ex
TF_CONFIG_FILE="tf-dev-override.tfrc"
go list -json -m github.com/hashicorp/terraform-provider-google-beta
REPLACE_DIR=`go list -json -m github.com/hashicorp/terraform-provider-google-beta | jq -r '.Dir // empty'`
VERSION=`go list -json -m github.com/hashicorp/terraform-provider-google-beta | jq -r .Version`
if [ ! -z "$REPLACE_DIR" ]
then
# for tests triggered by magic-module CI which replaces tpgb module
pushd $REPLACE_DIR
go install
popd
else
# for tests triggered in tgc CI
go install github.com/hashicorp/terraform-provider-google-beta@$VERSION
fi
# create terraform configuration file
if ! [ -f $TF_CONFIG_FILE ];then
cat <<EOF > $TF_CONFIG_FILE
provider_installation {
# Developer overrides will stop Terraform from downloading the listed
# providers their origin provider registries.
dev_overrides {
"hashicorp/google-beta" = "$(go env GOPATH)/bin"
}
# For all other providers, install them directly from their origin provider
# registries as normal. If you omit this, Terraform will _only_ use
# the dev_overrides block, and so no other providers will be available.
# Without this, show "Failed to query available provider packages"
# at terraform init
direct{}
}
EOF
fi