Skip to content

Fix tofu output printing debug information #89

Fix tofu output printing debug information

Fix tofu output printing debug information #89

Workflow file for this run

name: 'Setup OpenTofu'
on:
push:
branches:
- main
pull_request:
defaults:
run:
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
tofu-versions:
name: 'OpenTofu Versions'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
tofu-versions: [1.6.0-alpha1, latest]
tofu-wrapper: [true, false]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup OpenTofu - ${{ matrix['tofu-versions'] }}
uses: ./
with:
tofu_version: ${{ matrix['tofu-versions'] }}
tofu_wrapper: ${{ matrix['tofu-wrapper'] }}
- name: Validate that OpenTofu was installed
run: tofu version | grep 'OpenTofu v'
- name: Validate the Version ${{ matrix['tofu-versions'] }} was installed
if: ${{ matrix['tofu-versions'] != 'latest' }}
run: tofu version | grep ${{ matrix['tofu-versions']}}
tofu-arguments:
name: 'OpenTofu Arguments'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
tofu-wrapper: [true, false]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup OpenTofu
uses: ./
with:
tofu_wrapper: ${{ matrix['tofu-wrapper'] }}
- name: Check No Arguments
run: tofu || exit 0
- name: Check Single Argument
run: tofu help || exit 0
- name: Check Single Argument Hyphen
run: tofu -help
- name: Check Single Argument Double Hyphen
run: tofu --help
- name: Check Single Argument Subcommand
run: tofu fmt -check
- name: Check Multiple Arguments Subcommand
run: tofu fmt -check -list=true -no-color
tofu-run-local:
name: 'OpenTofu Run Local'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
tofu-wrapper: [true, false]
defaults:
run:
shell: bash
working-directory: ./.github/workflows/data/local
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup OpenTofu
uses: ./
with:
tofu_wrapper: ${{ matrix['tofu-wrapper'] }}
- name: OpenTofu Init
run: tofu init
- name: OpenTofu Format
run: tofu fmt -check
- name: OpenTofu Plan
id: plan
run: tofu plan
- name: Print OpenTofu Plan
if: ${{ matrix['tofu-wrapper'] == 'true' }}
run: echo "${{ steps.plan.outputs.stdout }}"
tofu-credentials-cloud:
name: 'OpenTofu Cloud Credentials'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
env:
TF_CLOUD_API_TOKEN: 'XXXXXXXXXXXXXX.atlasv1.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup OpenTofu
uses: ./
with:
cli_config_credentials_token: ${{ env.TF_CLOUD_API_TOKEN }}
- name: Validate OpenTofu Credentials (Windows)
if: runner.os == 'Windows'
run: |
cat ${APPDATA}/tofu.rc | grep 'credentials "app.terraform.io"'
cat ${APPDATA}/tofu.rc | grep 'token = "${{ env.TF_CLOUD_API_TOKEN }}"'
- name: Validate Teraform Credentials (Linux & macOS)
if: runner.os != 'Windows'
run: |
cat ${HOME}/.tofurc | grep 'credentials "app.terraform.io"'
cat ${HOME}/.tofurc | grep 'token = "${{ env.TF_CLOUD_API_TOKEN }}"'
tofu-credentials-enterprise:
name: 'OpenTofu Enterprise Credentials'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
env:
TF_CLOUD_API_TOKEN: 'XXXXXXXXXXXXXX.atlasv1.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup OpenTofu
uses: ./
with:
cli_config_credentials_hostname: 'tofu.example.com'
cli_config_credentials_token: ${{ env.TF_CLOUD_API_TOKEN }}
- name: Validate OpenTofu Credentials (Windows)
if: runner.os == 'Windows'
run: |
cat ${APPDATA}/tofu.rc | grep 'credentials "tofu.example.com"'
cat ${APPDATA}/tofu.rc | grep 'token = "${{ env.TF_CLOUD_API_TOKEN }}"'
- name: Validate Teraform Credentials (Linux & macOS)
if: runner.os != 'Windows'
run: |
cat ${HOME}/.tofurc | grep 'credentials "tofu.example.com"'
cat ${HOME}/.tofurc | grep 'token = "${{ env.TF_CLOUD_API_TOKEN }}"'
tofu-credentials-none:
name: 'OpenTofu No Credentials'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup OpenTofu
uses: ./
- name: Validate OpenTofu Credentials (Windows)
if: runner.os == 'Windows'
run: |
[[ -f ${APPDATA}/tofu.rc ]] || exit 0
- name: Validate Teraform Credentials (Linux & macOS)
if: runner.os != 'Windows'
run: |
[[ -f ${HOME}/.tofurc ]] || exit 0