Skip to content

Feat: support OpenTofu #451

Feat: support OpenTofu

Feat: support OpenTofu #451

Workflow file for this run

name: ci
on:
pull_request:
types: [opened, synchronize]
jobs:
unit-tests:
name: Unit Tests
timeout-minutes: 10
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/checkout@v5
with:
go-version: 1.21
- name: Go fmt
run: |
! go fmt ./... | read
- name: Go vet
run: |
! go vet ./... | read
- name: Go staticcheck
uses: dominikh/[email protected]
with:
version: "2023.1.3"
install-go: false
- name: Go Test
run: SKIP_INTEGRATION_TESTS=1 go test -v ./...
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
terraform_version: ['12','13','14','15','latest']
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/checkout@v5
with:
go-version: 1.21
id: go
- name: Get dependencies
run: |
go mod tidy
- name: Install tfenv
run: |
git clone https://github.com/tfutils/tfenv.git $GITHUB_WORKSPACE/.tfenv
echo "$GITHUB_WORKSPACE/.tfenv/bin" >> $GITHUB_PATH
- name: Install terraform
working-directory: test/tfenvconf/terraform_${{ matrix.terraform_version }}
run: |
tfenv install
tfenv use
- name: Print Terraform version
run: |
terraform --version
- name: Set Test-Suite
id: test-suite
env:
TF_VERSION: ${{ matrix.terraform_version }}
uses: actions/github-script@v6
with:
script: |
console.log(`Setting test suite version based on ${process.env.TF_VERSION}`)
const suite = process.env.TF_VERSION.replace('.', 'o')
console.log(`Test suite set to ${suite}`)
return suite
result-encoding: string
- name: Test
run: |
go test -v -run ^TestTerraform${{ steps.test-suite.outputs.result }}
terragrunt-integration-tests:
name: Terragrunt Integration Tests
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/checkout@v5
with:
go-version: 1.21
id: go
- name: Get dependencies
run: |
go mod tidy
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.2.5
- name: Print Terraform version
run: |
terraform --version
- name: Install Terragrunt
uses: autero1/[email protected]
with:
terragrunt_version: 0.54.22
- name: Print Terragrunt version
run: |
terragrunt --version
- name: Test
run: |
go test -v -run ^TestTerragruntWithCache$
opentofu-integration-tests:
name: OpenTofu Integration Tests
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/checkout@v5
with:
go-version: 1.21
id: go
- name: Get dependencies
run: |
go mod tidy
- name: Install OpenTofu
uses: opentofu/setup-opentofu@v1
- name: Print OpenTofu version
run: |
tofu --version
- name: Test
run: |
go test -v -run ^TestOpenTofu$