Modules Test Run - OpenTofu Latest #97
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 Opentofu Selectel Terraform modules' | |
on: | |
schedule: | |
- cron: '0 8 * * 5' # run every Friday at 11:00 MSK | |
workflow_dispatch: | |
jobs: | |
setup: | |
name: 'Test Opentofu Selectel Terraform modules' | |
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 | |
with: | |
tofu_version: 1.6.2 | |
- 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="endpoint=s3.ru-1.storage.selcloud.ru" | |
-backend-config="key=github-infra-examples.tfstate" | |
-backend-config="region=ru-1" | |
-backend-config="skip_region_validation=true" | |
-backend-config="skip_credentials_validation=true" | |
-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 |