Hide outdated comments #665
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test terraform-version | |
on: | |
- pull_request | |
jobs: | |
required_version: | |
runs-on: ubuntu-latest | |
name: specific required_version | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version | |
with: | |
path: tests/workflows/test-version/required_version | |
- name: Print the version | |
run: echo "The terraform version was ${{ steps.terraform-version.outputs.terraform }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "0.12.26" ]]; then | |
echo "::error:: Terraform version not set from required_version" | |
exit 1 | |
fi | |
required_version_range: | |
runs-on: ubuntu-latest | |
name: required_version range | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version | |
with: | |
path: tests/workflows/test-version/range | |
- name: Print the version | |
run: echo "The terraform version was ${{ steps.terraform-version.outputs.terraform }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "0.12.5" ]]; then | |
echo "::error:: Terraform version not set from required_version range" | |
exit 1 | |
fi | |
required_version_v_prefix: | |
runs-on: ubuntu-latest | |
name: required_version with a v prefix | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version | |
with: | |
path: tests/workflows/test-version/v-prefix | |
- name: Print the version | |
run: echo "The terraform version was ${{ steps.terraform-version.outputs.terraform }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "0.12.26" ]]; then | |
echo "::error:: Terraform version not set from required_version range" | |
exit 1 | |
fi | |
tfswitch: | |
runs-on: ubuntu-latest | |
name: tfswitch | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version | |
with: | |
path: tests/workflows/test-version/tfswitch | |
- name: Print the version | |
run: echo "The terraform version was ${{ steps.terraform-version.outputs.terraform }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "1.1.0" ]]; then | |
echo "::error:: Terraform version not set from .tfswitchrc" | |
exit 1 | |
fi | |
tfenv: | |
runs-on: ubuntu-latest | |
name: tfenv | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version | |
with: | |
path: tests/workflows/test-version/tfenv | |
- name: Print the version | |
run: echo "The terraform version was ${{ steps.terraform-version.outputs.terraform }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "0.12.17" ]]; then | |
echo "::error:: Terraform version not set from .terraform-version" | |
exit 1 | |
fi | |
asdf: | |
runs-on: ubuntu-latest | |
name: asdf | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test getting version from .tools-versions | |
uses: ./terraform-version | |
id: terraform-version | |
with: | |
path: tests/workflows/test-version/asdf | |
- name: Print the version | |
run: echo "The terraform version was ${{ steps.terraform-version.outputs.terraform }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "0.12.11" ]]; then | |
echo "::error:: Terraform version not set from .tool-versions" | |
exit 1 | |
fi | |
mv tests/workflows/test-version/asdf/.tool-versions .tool-versions | |
- name: Test getting version from root .tools-versions | |
uses: ./terraform-version | |
id: root-version | |
with: | |
path: tests/workflows/test-version/asdf | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.root-version.outputs.terraform }}" != "0.12.11" ]]; then | |
echo "::error:: Terraform version not set from .tool-versions" | |
exit 1 | |
fi | |
env: | |
runs-on: ubuntu-latest | |
name: TERRAFORM_VERSION range | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version | |
env: | |
TERRAFORM_VERSION: ">=0.12.0,<=0.12.5" | |
with: | |
path: tests/workflows/test-version/empty | |
- name: Print the version | |
run: echo "The terraform version was ${{ steps.terraform-version.outputs.terraform }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "0.12.5" ]]; then | |
echo "::error:: Terraform version not set from required_version range" | |
exit 1 | |
fi | |
tfc_workspace: | |
runs-on: ubuntu-latest | |
name: TFC Workspace | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create workspace | |
uses: ./terraform-new-workspace | |
env: | |
TERRAFORM_VERSION: 0.12.13 | |
with: | |
path: tests/workflows/test-version/terraform-cloud | |
workspace: test-1 | |
backend_config: token=${{ secrets.TF_API_TOKEN }} | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version | |
with: | |
path: tests/workflows/test-version/terraform-cloud | |
workspace: test-1 | |
backend_config: token=${{ secrets.TF_API_TOKEN }} | |
- name: Destroy workspace | |
uses: ./terraform-destroy-workspace | |
with: | |
path: tests/workflows/test-version/terraform-cloud | |
workspace: test-1 | |
backend_config: token=${{ secrets.TF_API_TOKEN }} | |
- name: Print the version | |
run: | | |
echo "The terraform version was ${{ steps.terraform-version.outputs.terraform }}" | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "0.12.13" ]]; then | |
echo "::error:: Terraform version not set from remote workspace" | |
exit 1 | |
fi | |
tfc_cloud_workspace: | |
runs-on: ubuntu-latest | |
name: TFC Cloud Configuration | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create workspace | |
uses: ./terraform-new-workspace | |
env: | |
TERRAFORM_VERSION: 1.1.2 | |
TERRAFORM_CLOUD_TOKENS: app.terraform.io=${{ secrets.TF_API_TOKEN }} | |
with: | |
path: tests/workflows/test-version/cloud | |
workspace: tfc_cloud_workspace-1 | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version | |
env: | |
TERRAFORM_CLOUD_TOKENS: app.terraform.io=${{ secrets.TF_API_TOKEN }} | |
with: | |
path: tests/workflows/test-version/cloud | |
workspace: tfc_cloud_workspace-1 | |
- name: Destroy workspace | |
uses: ./terraform-destroy-workspace | |
env: | |
TERRAFORM_CLOUD_TOKENS: app.terraform.io=${{ secrets.TF_API_TOKEN }} | |
with: | |
path: tests/workflows/test-version/cloud | |
workspace: tfc_cloud_workspace-1 | |
- name: Print the version | |
run: | | |
echo "The terraform version was ${{ steps.terraform-version.outputs.terraform }}" | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "1.1.2" ]]; then | |
echo "::error:: Terraform version not set from remote workspace" | |
exit 1 | |
fi | |
tfc_partial_cloud_workspace: | |
runs-on: ubuntu-latest | |
name: Partial TFC Cloud Configuration | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create workspace | |
uses: ./terraform-new-workspace | |
env: | |
TERRAFORM_VERSION: 1.2.1 | |
TERRAFORM_CLOUD_TOKENS: app.terraform.io=${{ secrets.TF_API_TOKEN }} | |
TF_CLOUD_ORGANIZATION: flooktech | |
with: | |
path: tests/workflows/test-version/partial-cloud | |
workspace: tfc_partial_cloud_workspace-1 | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version | |
env: | |
TERRAFORM_CLOUD_TOKENS: app.terraform.io=${{ secrets.TF_API_TOKEN }} | |
TF_CLOUD_ORGANIZATION: flooktech | |
with: | |
path: tests/workflows/test-version/partial-cloud | |
workspace: tfc_partial_cloud_workspace-1 | |
- name: Destroy workspace | |
uses: ./terraform-destroy-workspace | |
env: | |
TERRAFORM_CLOUD_TOKENS: app.terraform.io=${{ secrets.TF_API_TOKEN }} | |
TF_CLOUD_ORGANIZATION: flooktech | |
with: | |
path: tests/workflows/test-version/partial-cloud | |
workspace: tfc_partial_cloud_workspace-1 | |
- name: Print the version | |
run: | | |
echo "The terraform version was ${{ steps.terraform-version.outputs.terraform }}" | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "1.2.1" ]]; then | |
echo "::error:: Terraform version not set from remote workspace" | |
exit 1 | |
fi | |
tfc_partial_cloud_tags_workspace: | |
runs-on: ubuntu-latest | |
name: Partial TFC Cloud Configuration with tags | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create workspace | |
uses: ./terraform-new-workspace | |
env: | |
TERRAFORM_VERSION: 1.2.1 | |
TERRAFORM_CLOUD_TOKENS: app.terraform.io=${{ secrets.TF_API_TOKEN }} | |
TF_CLOUD_ORGANIZATION: flooktech | |
with: | |
path: tests/workflows/test-version/partial-cloud-tags | |
workspace: tfc_partial_cloud_tags_workspace-1 | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version | |
env: | |
TERRAFORM_CLOUD_TOKENS: app.terraform.io=${{ secrets.TF_API_TOKEN }} | |
TF_CLOUD_ORGANIZATION: flooktech | |
with: | |
path: tests/workflows/test-version/partial-cloud-tags | |
workspace: tfc_partial_cloud_tags_workspace-1 | |
- name: Destroy workspace | |
uses: ./terraform-destroy-workspace | |
env: | |
TERRAFORM_CLOUD_TOKENS: app.terraform.io=${{ secrets.TF_API_TOKEN }} | |
TF_CLOUD_ORGANIZATION: flooktech | |
with: | |
path: tests/workflows/test-version/partial-cloud-tags | |
workspace: tfc_partial_cloud_tags_workspace-1 | |
- name: Print the version | |
run: | | |
echo "The terraform version was ${{ steps.terraform-version.outputs.terraform }}" | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "1.2.1" ]]; then | |
echo "::error:: Terraform version not set from remote workspace" | |
exit 1 | |
fi | |
local_state: | |
runs-on: ubuntu-latest | |
name: Local State file | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version | |
with: | |
path: tests/workflows/test-version/local | |
- name: Print the version | |
run: | | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "0.15.4" ]]; then | |
echo "::error:: Terraform version not set from state file" | |
exit 1 | |
fi | |
remote_state: | |
runs-on: ubuntu-latest | |
name: Remote State file | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Apply default workspace | |
uses: ./terraform-apply | |
env: | |
TERRAFORM_VERSION: 0.12.9 | |
with: | |
variables: my_variable="hello" | |
path: tests/workflows/test-version/state | |
auto_approve: true | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version | |
with: | |
path: tests/workflows/test-version/state | |
- name: Destroy default workspace | |
uses: ./terraform-destroy | |
with: | |
path: tests/workflows/test-version/state | |
variables: my_variable="goodbye" | |
- name: Print the version | |
run: | | |
echo "The terraform version was ${{ steps.terraform-version.outputs.terraform }}" | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "0.12.9" ]]; then | |
echo "::error:: Terraform version not set from state file" | |
exit 1 | |
fi | |
- name: Create second workspace | |
uses: ./terraform-new-workspace | |
env: | |
TERRAFORM_VERSION: 1.1.0 | |
with: | |
path: tests/workflows/test-version/state | |
workspace: second | |
- name: Apply second workspace | |
uses: ./terraform-apply | |
with: | |
variables: my_variable="goodbye" | |
path: tests/workflows/test-version/state | |
workspace: second | |
auto_approve: true | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version-second | |
with: | |
path: tests/workflows/test-version/state | |
workspace: second | |
- name: Destroy second workspace | |
uses: ./terraform-destroy-workspace | |
with: | |
path: tests/workflows/test-version/state | |
workspace: second | |
variables: my_variable="goodbye" | |
- name: Print the version | |
run: | | |
echo "The terraform version was ${{ steps.terraform-version-second.outputs.terraform }}" | |
if [[ "${{ steps.terraform-version-second.outputs.terraform }}" != "1.1.0" ]]; then | |
echo "::error:: Terraform version not set from state file" | |
exit 1 | |
fi | |
- name: Create third workspace | |
uses: ./terraform-new-workspace | |
env: | |
TERRAFORM_VERSION: 0.13.0 | |
with: | |
path: tests/workflows/test-version/state | |
workspace: third | |
- name: Apply third workspace | |
uses: ./terraform-apply | |
with: | |
variables: my_variable="goodbye" | |
path: tests/workflows/test-version/state | |
workspace: third | |
auto_approve: true | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version-third | |
with: | |
path: tests/workflows/test-version/state | |
workspace: third | |
- name: Destroy third workspace | |
uses: ./terraform-destroy-workspace | |
with: | |
path: tests/workflows/test-version/state | |
workspace: third | |
variables: my_variable="goodbye" | |
- name: Print the version | |
run: | | |
echo "The terraform version was ${{ steps.terraform-version-third.outputs.terraform }}" | |
if [[ "${{ steps.terraform-version-third.outputs.terraform }}" != "0.13.0" ]]; then | |
echo "::error:: Terraform version not set from state file" | |
exit 1 | |
fi | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version-fourth | |
with: | |
path: tests/workflows/test-version/state | |
workspace: fourth | |
- name: Print the version | |
run: | | |
echo "The terraform version was ${{ steps.terraform-version-fourth.outputs.terraform }}" | |
if [[ "${{ steps.terraform-version-fourth.outputs.terraform }}" != "1."* ]]; then | |
echo "::error:: Terraform version not set to latest when no existing state" | |
exit 1 | |
fi | |
empty_path: | |
runs-on: ubuntu-latest | |
name: latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version | |
with: | |
path: tests/workflows/test-version/empty | |
- name: Print the version | |
run: echo "The terraform version was ${{ steps.terraform-version.outputs.terraform }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != *"1.9"* ]]; then | |
echo "::error:: Latest version was not used" | |
exit 1 | |
fi | |
- name: Version doesn't exist | |
uses: ./terraform-new-workspace | |
continue-on-error: true | |
id: no-such-version | |
env: | |
TERRAFORM_VERSION: 99.0.0 | |
with: | |
path: tests/workflows/test-version/empty | |
- name: Check failed to download no such version | |
run: | | |
if [[ "${{ steps.no-such-version.outcome }}" != "failure" ]]; then | |
echo "Did not fail correctly" | |
exit 1 | |
fi | |
provider_versions: | |
runs-on: ubuntu-latest | |
name: provider versions | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test terraform-version with 0.12 | |
uses: ./terraform-version | |
id: terraform-version-12 | |
with: | |
path: tests/workflows/test-version/providers/0.12 | |
- name: Print the version | |
run: | | |
echo "The terraform version was ${{ steps.terraform-version-12.outputs.terraform }}" | |
echo "The random version was ${{ steps.terraform-version-12.outputs.random }}" | |
echo "The acme version was ${{ steps.terraform-version-12.outputs.acme }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.terraform-version-12.outputs.random }}" != "2.2.0" ]]; then | |
echo "::error:: random provider version has not been set" | |
exit 1 | |
fi | |
if [[ -z "${{ steps.terraform-version-12.outputs.acme }}" ]]; then | |
echo "::error:: acme provider version has not been set" | |
exit 1 | |
fi | |
- name: Test terraform-version with 0.13 | |
uses: ./terraform-version | |
id: terraform-version-13 | |
with: | |
path: tests/workflows/test-version/providers/0.13 | |
- name: Print the version | |
run: | | |
echo "The terraform version was ${{ steps.terraform-version-13.outputs.terraform }}" | |
echo "The random version was ${{ steps.terraform-version-13.outputs.random }}" | |
echo "The acme version was ${{ steps.terraform-version-13.outputs.acme }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.terraform-version-13.outputs.random }}" != "2.2.0" ]]; then | |
echo "::error:: random provider version has not been set" | |
exit 1 | |
fi | |
if [[ -z "${{ steps.terraform-version-13.outputs.acme }}" ]]; then | |
echo "::error:: acme provider version has not been set" | |
exit 1 | |
fi | |
- name: Test terraform-version with 0.11 | |
uses: ./terraform-version | |
id: terraform-version-11 | |
with: | |
path: tests/workflows/test-version/providers/0.11 | |
- name: Print the version | |
run: | | |
echo "The terraform version was ${{ steps.terraform-version-11.outputs.terraform }}" | |
echo "The random version was ${{ steps.terraform-version-11.outputs.random }}" | |
echo "The acme version was ${{ steps.terraform-version-11.outputs.acme }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.terraform-version-11.outputs.random }}" != "2.2.0" ]]; then | |
echo "::error:: random provider version has not been set" | |
exit 1 | |
fi | |
if [[ -z "${{ steps.terraform-version-11.outputs.acme }}" ]]; then | |
echo "::error:: acme provider version has not been set" | |
exit 1 | |
fi | |
# arm64: | |
# runs-on: buildjet-2vcpu-ubuntu-2204-arm | |
# name: Version detection on arm | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
# | |
# - name: Version unsupported on arm | |
# uses: ./terraform-version | |
# continue-on-error: true | |
# id: arm-unsupported | |
# env: | |
# TERRAFORM_VERSION: 0.12.0 | |
# with: | |
# path: tests/workflows/test-version/empty | |
# | |
# - name: Check failed to download unsupported platform | |
# run: | | |
# if [[ "${{ steps.arm-unsupported.outcome }}" != "failure" ]]; then | |
# echo "Did not fail correctly" | |
# exit 1 | |
# fi | |
# | |
# - name: Version doesn't exist | |
# uses: ./terraform-version | |
# continue-on-error: true | |
# id: no-such-version | |
# with: | |
# path: tests/workflows/test-version/nosuchversion | |
# | |
# - name: Check failed to download no such version | |
# run: | | |
# if [[ "${{ steps.no-such-version.outcome }}" != "failure" ]]; then | |
# echo "Did not fail correctly" | |
# exit 1 | |
# fi | |
# | |
# - name: Test terraform-version | |
# uses: ./terraform-version | |
# id: terraform-version | |
# with: | |
# path: tests/workflows/test-version/tfswitch | |
# | |
# - name: Check the version | |
# run: | | |
# if [[ "${{ steps.terraform-version.outputs.terraform }}" != "1.1.0" ]]; then | |
# echo "::error:: Terraform version not set from .tfswitchrc" | |
# exit 1 | |
# fi | |
terraform_opentofu_version: | |
runs-on: ubuntu-latest | |
name: OPENTOFU_VERSION with terraform action | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test terraform-version | |
uses: ./terraform-version | |
id: terraform-version | |
env: | |
OPENTOFU_VERSION: "1.6.0" | |
with: | |
path: tests/workflows/test-version/empty | |
- name: Print the version | |
run: echo "The tofu version was ${{ steps.terraform-version.outputs.tofu }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "1.6.0" ]]; then | |
echo "::error:: Terraform version not set from OPENTOFU_VERSION" | |
exit 1 | |
fi | |
if [[ "${{ steps.terraform-version.outputs.tofu }}" != "1.6.0" ]]; then | |
echo "::error:: Terraform version not set from OPENTOFU_VERSION" | |
exit 1 | |
fi | |
opentofu_version: | |
runs-on: ubuntu-latest | |
name: OPENTOFU_VERSION with tofu action | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test terraform-version | |
uses: ./tofu-version | |
id: tofu-version | |
env: | |
OPENTOFU_VERSION: "1.6.0" | |
with: | |
path: tests/workflows/test-version/empty | |
- name: Print the version | |
run: echo "The tofu version was ${{ steps.tofu-version.outputs.tofu }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.tofu-version.outputs.terraform }}" != "1.6.0" ]]; then | |
echo "::error:: Terraform version not set from OPENTOFU_VERSION" | |
exit 1 | |
fi | |
if [[ "${{ steps.tofu-version.outputs.tofu }}" != "1.6.0" ]]; then | |
echo "::error:: Terraform version not set from OPENTOFU_VERSION" | |
exit 1 | |
fi | |
opentofu_version_pre_release_nosig: | |
runs-on: ubuntu-latest | |
name: OPENTOFU_VERSION pre-release with tofu action | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test terraform-version | |
uses: ./tofu-version | |
id: tofu-version | |
env: | |
OPENTOFU_VERSION: "1.6.0-alpha3" | |
with: | |
path: tests/workflows/test-version/empty | |
- name: Print the version | |
run: echo "The tofu version was ${{ steps.tofu-version.outputs.tofu }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.tofu-version.outputs.terraform }}" != "1.6.0-alpha3" ]]; then | |
echo "::error:: Terraform version not set from OPENTOFU_VERSION" | |
exit 1 | |
fi | |
if [[ "${{ steps.tofu-version.outputs.tofu }}" != "1.6.0-alpha3" ]]; then | |
echo "::error:: Terraform version not set from OPENTOFU_VERSION" | |
exit 1 | |
fi | |
opentofu_old_version: | |
runs-on: ubuntu-latest | |
name: Prefer OpenTofu, but only Terraform matches constraints | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test terraform-version | |
uses: ./tofu-version | |
id: tofu-version | |
env: | |
OPENTOFU_VERSION: "<1.6.0" | |
with: | |
path: tests/workflows/test-version/empty | |
- name: Print the version | |
run: echo "The terraform version was ${{ steps.tofu-version.outputs.terraform }}" | |
- name: Check the version | |
run: | | |
if [[ "${{ steps.tofu-version.outputs.terraform }}" != *"1.5"* ]]; then | |
echo "::error:: Terraform version not selected" | |
exit 1 | |
fi |