Skip to content

Commit

Permalink
Merge pull request hashicorp#15 from hashicorp/tfe
Browse files Browse the repository at this point in the history
Add Terraform Enterprise support
  • Loading branch information
lkysow committed Mar 29, 2019
2 parents 5942461 + 3945576 commit 4a4cc1a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
8 changes: 8 additions & 0 deletions init/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
set -e
cd "${TF_ACTION_WORKING_DIR:-.}"

if [[ ! -z "$TF_ACTION_TFE_TOKEN" ]]; then
cat > ~/.terraformrc << EOF
credentials "${TF_ACTION_TFE_HOSTNAME:-app.terraform.io}" {
token = "$TF_ACTION_TFE_TOKEN"
}
EOF
fi

set +e
OUTPUT=$(sh -c "terraform init -no-color -input=false $*" 2>&1)
SUCCESS=$?
Expand Down
13 changes: 11 additions & 2 deletions plan/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@ set -e

cd "${TF_ACTION_WORKING_DIR:-.}"

WORKSPACE=${TF_ACTION_WORKSPACE:-default}
terraform workspace select "$WORKSPACE"
if [[ ! -z "$TF_ACTION_TFE_TOKEN" ]]; then
cat > ~/.terraformrc << EOF
credentials "${TF_ACTION_TFE_HOSTNAME:-app.terraform.io}" {
token = "$TF_ACTION_TFE_TOKEN"
}
EOF
fi

if [[ ! -z "$TF_ACTION_WORKSPACE" ]] && [[ "$TF_ACTION_WORKSPACE" != "default" ]]; then
terraform workspace select "$TF_ACTION_WORKSPACE"
fi

set +e
OUTPUT=$(sh -c "TF_IN_AUTOMATION=true terraform plan -no-color -input=false $*" 2>&1)
Expand Down
5 changes: 3 additions & 2 deletions validate/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
set -e
cd "${TF_ACTION_WORKING_DIR:-.}"

WORKSPACE=${TF_ACTION_WORKSPACE:-default}
terraform workspace select "$WORKSPACE"
if [[ ! -z "$TF_ACTION_WORKSPACE" ]] && [[ "$TF_ACTION_WORKSPACE" != "default" ]]; then
terraform workspace select "$TF_ACTION_WORKSPACE"
fi

set +e
OUTPUT=$(sh -c "terraform validate -no-color $*" 2>&1)
Expand Down

0 comments on commit 4a4cc1a

Please sign in to comment.