File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 2
2
set -e
3
3
cd " ${TF_ACTION_WORKING_DIR:- .} "
4
4
5
+ if [[ ! -z " $TF_ACTION_TFE_TOKEN " ]]; then
6
+ cat > ~ /.terraformrc << EOF
7
+ credentials "${TF_ACTION_TFE_HOSTNAME:- app.terraform.io} " {
8
+ token = "$TF_ACTION_TFE_TOKEN "
9
+ }
10
+ EOF
11
+ fi
12
+
5
13
set +e
6
14
OUTPUT=$( sh -c " terraform init -no-color -input=false $* " 2>&1 )
7
15
SUCCESS=$?
Original file line number Diff line number Diff line change @@ -26,8 +26,17 @@ set -e
26
26
27
27
cd " ${TF_ACTION_WORKING_DIR:- .} "
28
28
29
- WORKSPACE=${TF_ACTION_WORKSPACE:- default}
30
- terraform workspace select "$WORKSPACE"
29
+ if [[ ! -z " $TF_ACTION_TFE_TOKEN " ]]; then
30
+ cat > ~ /.terraformrc << EOF
31
+ credentials "${TF_ACTION_TFE_HOSTNAME:- app.terraform.io} " {
32
+ token = "$TF_ACTION_TFE_TOKEN "
33
+ }
34
+ EOF
35
+ fi
36
+
37
+ if [[ ! -z " $TF_ACTION_WORKSPACE " ]] && [[ " $TF_ACTION_WORKSPACE " != " default" ]]; then
38
+ terraform workspace select "$TF_ACTION_WORKSPACE"
39
+ fi
31
40
32
41
set +e
33
42
OUTPUT=$( sh -c " TF_IN_AUTOMATION=true terraform plan -no-color -input=false $* " 2>&1 )
Original file line number Diff line number Diff line change 2
2
set -e
3
3
cd " ${TF_ACTION_WORKING_DIR:- .} "
4
4
5
- WORKSPACE=${TF_ACTION_WORKSPACE:- default}
6
- terraform workspace select "$WORKSPACE"
5
+ if [[ ! -z " $TF_ACTION_WORKSPACE " ]] && [[ " $TF_ACTION_WORKSPACE " != " default" ]]; then
6
+ terraform workspace select "$TF_ACTION_WORKSPACE"
7
+ fi
7
8
8
9
set +e
9
10
OUTPUT=$( sh -c " terraform validate -no-color $* " 2>&1 )
You can’t perform that action at this time.
0 commit comments