Skip to content

Commit db41a65

Browse files
committed
Add testdata script
1 parent 3303ee1 commit db41a65

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/sh
2+
3+
VERSION=$1
4+
MODE=$2
5+
shift 2
6+
7+
json_print() {
8+
echo "{\"@level\":\"error\",\"@message\":\"$*\"}"
9+
}
10+
11+
case "$1" in
12+
version)
13+
cat <<-EOF
14+
{
15+
"terraform_version": "${VERSION}",
16+
"platform": "linux_amd64",
17+
"provider_selections": {},
18+
"terraform_outdated": false
19+
}
20+
EOF
21+
exit 0
22+
;;
23+
init)
24+
case "$MODE" in
25+
apply)
26+
echo "init"
27+
;;
28+
init)
29+
sleep 10 &
30+
sleep_pid=$!
31+
32+
trap 'echo exit; kill -9 $sleep_pid 2>/dev/null' EXIT
33+
trap 'echo interrupt; exit 1' INT
34+
trap 'echo terminate"; exit 2' TERM
35+
36+
echo init_start
37+
wait
38+
echo init_end
39+
;;
40+
esac
41+
;;
42+
apply)
43+
sleep 10 &
44+
sleep_pid=$!
45+
46+
trap 'json_print exit; kill -9 $sleep_pid 2>/dev/null' EXIT
47+
trap 'json_print interrupt; exit 1' INT
48+
trap 'json_print terminate"; exit 2' TERM
49+
50+
json_print apply_start
51+
wait
52+
json_print apply_end
53+
;;
54+
plan)
55+
echo "plan not supported"
56+
exit 1
57+
;;
58+
esac
59+
60+
exit 0

0 commit comments

Comments
 (0)