Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/checkout-4…
Browse files Browse the repository at this point in the history
….2.0
  • Loading branch information
rdhar authored Oct 7, 2024
2 parents e2cc4cd + a68ca44 commit fde675a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tf_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
arg_command: ${{ github.event.pull_request.merged && 'apply' || 'plan' }}
arg_lock: ${{ github.event.pull_request.merged && 'true' || 'false' }}
arg_detailed_exitcode: true
tenv_version: v3.2.3
tf_tool: ${{ matrix.tool }}
tf_version: ~> 1.8.0

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ In order to locally decrypt the TF plan file, use the following command (noting
| `fmt_enable`</br>Default: `true` | Boolean flag to enable TF fmt command and display diff of changes. |
| `label_pr`</br>Default: `true` | Boolean flag to add PR label of TF command to run. |
| `plan_parity`</br>Default: `false` | Boolean flag to compare the TF plan file with a newly-generated one to prevent stale apply. |
| `tenv_version`</br>Example: `v3.1.0` | String version tag of the tenv tool to install and use. |
| `tenv_arch`</br>Default: `amd64` | String architecture of the tenv tool to install and use. |
| `tenv_version`</br>Example: `v3.2.3` | String version tag of the tenv tool to install and use. |
| `tf_tool`</br>Default: `terraform` | String name of the TF tool to use and override default assumption from wrapper environment variable. |
| `tf_version`</br>Example: `~> 1.8.0` | String version constraint of the TF tool to install and use. |
| `update_comment`</br>Default: `false` | Boolean flag to update existing PR comment instead of creating a new comment and deleting the old one. |
Expand Down
12 changes: 9 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ inputs:
description: Boolean flag to compare the TF plan file with a newly-generated one to prevent stale apply.
required: false
default: "false"
tenv_arch:
description: String architecture of the tenv tool to install and use.
required: false
default: "amd64"
tenv_version:
description: String version tag of the tenv tool to install and use.
required: false
Expand Down Expand Up @@ -268,7 +272,7 @@ runs:
- name: Cache TF plugins
id: cache_plugins
if: inputs.cache_plugins == 'true' && hashFiles(format('{0}/.terraform.lock.hcl', inputs.arg_chdir))
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4.1.0
with:
key: ${{ runner.os }}-${{ inputs.tf_tool }}-${{ inputs.tf_version }}-${{ hashFiles(format('{0}/.terraform.lock.hcl', inputs.arg_chdir)) }}
path: |
Expand All @@ -278,16 +282,18 @@ runs:
- name: Install TF via tenv
if: inputs.tf_version != ''
env:
TENV_ARCH: ${{ inputs.tenv_arch }}
TENV_VERSION: ${{ inputs.tenv_version }}
TF_TOOL: ${{ inputs.tf_tool }}
TF_VERSION: ${{ inputs.tf_version }}
shell: bash
run: |
# If $TENV_VERSION is not set, then retrieve the latest version.
if [ -z "$TENV_VERSION" ]; then
TENV_VERSION=$(curl --no-progress-meter --location https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r .tag_name)
fi
curl --remote-name --no-progress-meter --location "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${TENV_VERSION}_amd64.deb"
sudo dpkg --install "tenv_${TENV_VERSION}_amd64.deb"
curl --remote-name --no-progress-meter --location "https://github.com/tofuutils/tenv/releases/download/${TENV_VERSION}/tenv_${TENV_VERSION}_${TENV_ARCH}.deb"
sudo dpkg --install "tenv_${TENV_VERSION}_${TENV_ARCH}.deb"
tenv "$TF_TOOL" install "$TF_VERSION"
tenv update-path
Expand Down

0 comments on commit fde675a

Please sign in to comment.