Skip to content

Modules Test Run - Terraform v1.10.3 #393

Modules Test Run - Terraform v1.10.3

Modules Test Run - Terraform v1.10.3 #393

Workflow file for this run

name: 'Modules Test Run - Terraform v1.10.3'
on:
schedule:
- cron: '0 8 * * 2' # run every Tuesday at 11:00 MSK
workflow_dispatch:
jobs:
setup:
name: 'Modules Test Run - Terraform v1.10.3'
runs-on: self-hosted
env:
terraform_link: ${{ secrets.TERRAFORM_BINARY }}
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.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
shell: bash
run: |
curl -o terraform.zip $terraform_link
unzip terraform.zip
rm terraform.zip
chmod 755 terraform
mv terraform /usr/local/bin
# - 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: Add .terraformrc
shell: bash
run: |
cat <<EOS >> $HOME/.terraformrc
provider_installation {
network_mirror {
url = "https://tf-proxy.selectel.ru/mirror/v1/"
}
}
EOS
- name: Lint Terraform
run: terraform fmt -diff -check -recursive
- name: Init Terraform
run: >
terraform 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: Terraform apply
run: terraform apply -auto-approve
- name: Terraform destroy
run: terraform destroy -auto-approve
- name: Telegram notify if failed on main branch
if: ${{ (failure()) && (github.ref == 'refs/heads/main') }}
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
⚙️ *GitHub repository selectel/selectel-infra-examples*
🔥 *Pipeline has failed*
➡️ *Workflow:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}