Modules Test Run - Terraform v1.10.3 #106
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 Selectel Terraform modules' | |
on: | |
schedule: | |
- cron: '0 7 * * *' # run every day at 10:00 MSK | |
workflow_dispatch: | |
jobs: | |
setup: | |
name: 'Test 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 }} | |
terraform_remote_state_address: ${{ secrets.GITLAB_STATE_ADDRESS }} | |
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }} | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
- name: Setup NodeJS v20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Setup Terraform | |
uses: hashicorp/[email protected] | |
# - name: Run Checkov action # suppressed for now because it fails to copy a file inside a self-hosted runner | |
# uses: bridgecrewio/checkov-action@v12 | |
# with: | |
# quiet: true | |
# directory: . | |
# output_format: cli | |
# framework: terraform,github_actions | |
# container_user: 1000 | |
- name: Lint Terraform | |
run: terraform fmt -diff -check -recursive | |
- name: Init Terraform | |
run: > | |
terraform init -reconfigure | |
-backend-config="address=$terraform_remote_state_address" | |
-backend-config="lock_address=$terraform_remote_state_address/lock" | |
-backend-config="unlock_address=$terraform_remote_state_address/lock" | |
-backend-config="username=${{ secrets.GITLAB_STATE_USERNAME }}" | |
-backend-config="password=${{ secrets.GITLAB_STATE_TOKEN }}" | |
-backend-config="lock_method=POST" | |
-backend-config="unlock_method=DELETE" | |
-backend-config="retry_wait_min=5" | |
- name: Terraform apply | |
run: terraform apply -auto-approve | |
- name: Terraform destroy | |
run: terraform destroy -auto-approve | |
- name: Telegram notify if job was failed | |
if: ${{ failure() }} | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_TO }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: | | |
-= GITHUB public repository selectel/selectel-infra-examples =- | |
Terraform modules build pipeline was failed | |
🚨 Critical | |
Не катится пайпа, необходимо принять меры, возможно внутренние пайпы с terraform так же не будут катиться. | |
⚡️Workflow: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
🔥 See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }} |