Modules Test Run - OpenTofu Latest #108
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: 'Modules Test Run - OpenTofu Latest' | |
on: | |
schedule: | |
- cron: '0 8 * * 5' # run every Friday at 11:00 MSK | |
workflow_dispatch: | |
jobs: | |
setup: | |
name: 'Modules Test Run - OpenTofu Latest' | |
runs-on: self-hosted | |
env: | |
TF_VAR_selectel_domain_name: ${{ secrets.SELECTEL_ID }} | |
TF_VAR_selectel_user_admin_user: ${{ secrets.SERVICE_USER }} | |
TF_VAR_selectel_user_admin_password: ${{ secrets.SERVICE_PASSWORD }} | |
TF_VAR_flavor_name: ${{ secrets.FLAVOR_NAME }} | |
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }} | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
- name: Setup OpenTofu | |
uses: opentofu/setup-opentofu@v1 | |
- name: Add .tofurc | |
shell: bash | |
run: | | |
cat <<EOS >> $HOME/.tofurc | |
provider_installation { | |
network_mirror { | |
url = "https://tf-proxy.selectel.ru/mirror/v1/" | |
} | |
} | |
EOS | |
- name: Lint OpenTofu | |
run: tofu fmt -diff -check -recursive | |
- name: Init OpenTofu | |
run: > | |
tofu init -reconfigure | |
-backend-config="bucket=github-terraform-state" | |
-backend-config="key=github-infra-examples.tfstate" | |
-backend-config="access_key=${{ secrets.S3_ACCESS_KEY }}" | |
-backend-config="secret_key=${{ secrets.S3_SECRET_KEY }}" | |
- name: OpenTofu apply | |
run: tofu apply -auto-approve | |
- name: OpenTofu destroy | |
run: tofu destroy -auto-approve |