forked from volcengine/terraform-provider-volcengine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
29 lines (24 loc) · 776 Bytes
/
build.sh
File metadata and controls
29 lines (24 loc) · 776 Bytes
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
#!/bin/bash
OS=$1
ARCH=$2
NAME="terraform-provider-volcengine"
set -ea
if [ "$OS" == "" ]
then
OS="darwin"
fi
if [ "$ARCH" == "" ]
then
ARCH="amd64"
fi
CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCH go build -o $NAME
# rm -f $GOPATH/bin/$NAME
# cp $NAME $GOPATH/bin/
# 如果terraform版本高于或者等于0.13
# 需要执行如下三条指令 来映射CLI到本地路径
# 如果小于此版本可以不做这三个操作
# shellcheck disable=SC2154
mkdir -p ~/.terraform.d/plugins/registry.terraform.io/hashicorp/volcengine/0.0.1/"$OS"_"$ARCH"/
rm -f ~/.terraform.d/plugins/registry.terraform.io/hashicorp/volcengine/0.0.1/"$OS"_"$ARCH"/"$NAME"_v0.0.1
cp $NAME ~/.terraform.d/plugins/registry.terraform.io/hashicorp/volcengine/0.0.1/"$OS"_"$ARCH"/"$NAME"_v0.0.1
rm -f $NAME