Add OpenTofu min supported version to readme #790
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: tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
TERRAFORM_VERSION: 1.8.* | |
OPENTOFU_VERSION: 1.7.0 | |
jobs: | |
# Ensure project builds before running testing matrix | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: 1.22.x | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- uses: hashicorp/setup-terraform@97f030cf6dc0b4f5e0da352c7bca9cca34579800 # v3.1.0 | |
with: | |
terraform_version: "${{env.TERRAFORM_VERSION}}" | |
terraform_wrapper: false | |
- name: Install tools | |
run: make tools | |
- name: Build | |
run: make build | |
- name: Generate docs | |
run: make docs | |
- name: Check if working tree is dirty | |
run: | | |
if [[ $(git diff --stat) != '' ]]; then | |
git diff | |
echo "run 'make build docs' and commit changes" | |
exit 1 | |
fi | |
# Run acceptance tests in a matrix with Terraform CLI versions | |
test: | |
name: Terraform Provider Acceptance Tests | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
terraform: | |
- '1.7.*' | |
- '1.8.*' | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: 1.22.x | |
- uses: hashicorp/setup-terraform@97f030cf6dc0b4f5e0da352c7bca9cca34579800 # v3.1.0 | |
with: | |
terraform_version: ${{ matrix.terraform }} | |
terraform_wrapper: false | |
- name: Run tests | |
run: make testacc | |
e2e-flux-bootstrap-with-github: | |
name: Terraform - E2E Flux with GitHub Bootstrap | |
runs-on: ubuntu-latest | |
needs: build | |
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Go | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: 1.22.x | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Setup Flux CLI | |
uses: fluxcd/flux2/action@534684601ec8888beb0cc4f51117b59e97606c4d # v2.2.3 | |
- name: Set outputs | |
id: vars | |
run: | | |
REPOSITORY_NAME=${{ github.event.repository.name }} | |
BRANCH_NAME=${GITHUB_REF##*/} | |
COMMIT_SHA=$(git rev-parse HEAD) | |
PSEUDO_RAND_SUFFIX=$(echo "${BRANCH_NAME}-${COMMIT_SHA}" | shasum | awk '{print $1}') | |
TEST_REPO_NAME="${REPOSITORY_NAME}-${PSEUDO_RAND_SUFFIX}" | |
echo "test_repo_name=$TEST_REPO_NAME" >> $GITHUB_OUTPUT | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@97f030cf6dc0b4f5e0da352c7bca9cca34579800 # v3.1.0 | |
with: | |
terraform_version: "${{env.TERRAFORM_VERSION}}" | |
terraform_wrapper: false | |
- name: Build provider | |
run: | | |
make build | |
make terraformrc | |
trc="${PWD}/.terraformrc" | |
echo "TF_CLI_CONFIG_FILE=${trc}" >> "$GITHUB_ENV" | |
- name: Apply Terraform | |
run: | | |
cd examples/github-via-ssh | |
terraform init | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Health check Flux | |
run: | | |
flux check | |
flux get all | |
- name: No-op apply Terraform | |
run: | | |
cd examples/github-via-ssh | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Teardown Flux | |
run: | | |
flux uninstall -s --keep-namespace | |
kubectl delete ns flux-system | |
- name: Restore Flux with Terraform | |
run: | | |
cd examples/github-via-ssh | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: No-op apply Terraform | |
run: | | |
cd examples/github-via-ssh | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Destroy Terraform | |
run: | | |
cd examples/github-via-ssh | |
terraform destroy -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Delete repository | |
if: ${{ always() }} | |
continue-on-error: true | |
run: | | |
gh repo delete fluxcd-testing/${{ steps.vars.outputs.test_repo_name }} --yes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
e2e-helm-install-with-github: | |
name: Terraform - E2E Helm Install with GitHub | |
runs-on: ubuntu-latest | |
needs: build | |
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Go | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: 1.22.x | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Setup Flux CLI | |
uses: fluxcd/flux2/action@534684601ec8888beb0cc4f51117b59e97606c4d # v2.2.3 | |
- name: Set outputs | |
id: vars | |
run: | | |
REPOSITORY_NAME=${{ github.event.repository.name }} | |
BRANCH_NAME=${GITHUB_REF##*/} | |
COMMIT_SHA=$(git rev-parse HEAD) | |
PSEUDO_RAND_SUFFIX=$(echo "${BRANCH_NAME}-${COMMIT_SHA}" | shasum | awk '{print $1}') | |
TEST_REPO_NAME="${REPOSITORY_NAME}-${PSEUDO_RAND_SUFFIX}-helm-install" | |
echo "test_repo_name=$TEST_REPO_NAME" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@97f030cf6dc0b4f5e0da352c7bca9cca34579800 # v3.1.0 | |
with: | |
terraform_version: "${{env.TERRAFORM_VERSION}}" | |
terraform_wrapper: false | |
- name: Apply Terraform | |
run: | | |
cd examples/helm-install | |
terraform init | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Health check Flux | |
run: flux check | |
- name: Destroy Terraform | |
run: | | |
cd examples/helm-install | |
terraform destroy -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Delete repository | |
if: ${{ always() }} | |
continue-on-error: true | |
run: | | |
gh repo delete fluxcd-testing/${{ steps.vars.outputs.test_repo_name }} --yes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
e2e-flux-bootstrap-with-github-pat: | |
name: Terraform - E2E Flux with GitHub Bootstrap | |
runs-on: ubuntu-latest | |
needs: build | |
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Go | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: 1.22.x | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Setup Flux CLI | |
uses: fluxcd/flux2/action@534684601ec8888beb0cc4f51117b59e97606c4d # v2.2.3 | |
- name: Set outputs | |
id: vars | |
run: | | |
REPOSITORY_NAME=${{ github.event.repository.name }} | |
BRANCH_NAME=${GITHUB_REF##*/} | |
COMMIT_SHA=$(git rev-parse HEAD) | |
PSEUDO_RAND_SUFFIX=$(echo "${BRANCH_NAME}-${COMMIT_SHA}" | shasum | awk '{print $1}') | |
TEST_REPO_NAME="${REPOSITORY_NAME}-${PSEUDO_RAND_SUFFIX}-using-pat" | |
echo "test_repo_name=$TEST_REPO_NAME" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@97f030cf6dc0b4f5e0da352c7bca9cca34579800 # v3.1.0 | |
with: | |
terraform_version: "${{env.TERRAFORM_VERSION}}" | |
terraform_wrapper: false | |
- name: Build provider | |
run: | | |
make build | |
make terraformrc | |
trc="${PWD}/.terraformrc" | |
echo "TF_CLI_CONFIG_FILE=${trc}" >> "$GITHUB_ENV" | |
- name: Apply Terraform | |
run: | | |
cd examples/github-via-pat | |
terraform init | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Health check Flux | |
run: flux check | |
- name: Destroy Terraform | |
run: | | |
cd examples/github-via-pat | |
terraform destroy -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Delete repository | |
if: ${{ always() }} | |
continue-on-error: true | |
run: | | |
gh repo delete fluxcd-testing/${{ steps.vars.outputs.test_repo_name }} --yes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} |