Skip to content
Latchkey

lint_terraform workflow (open-duelyst/duelyst)

The lint_terraform workflow from open-duelyst/duelyst, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: open-duelyst/duelyst.github/workflows/lint_terraform.yamlLicense CC0-1.0View source

What it does

This is the lint_terraform workflow from the open-duelyst/duelyst repository, a real project running GitHub Actions. It is shown here with attribution under its CC0-1.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: lint_terraform

on:
  push:
    branches:
    - main
  pull_request:
    paths:
      - terraform/**.tf

jobs:
  linting:
    runs-on: ubuntu-latest
    steps:
    - name: check out code
      uses: actions/checkout@v3

    - name: install terraform
      run: |
        wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
        echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
        sudo apt update && sudo apt install terraform=1.3.0

    - name: install tflint
      run: curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash

    - name: lint terraform code
      run: scripts/tflint.sh

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: lint_terraform
 
on:
  push:
    branches:
    - main
  pull_request:
    paths:
      - terraform/**.tf
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  linting:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
    - name: check out code
      uses: actions/checkout@v3
 
    - name: install terraform
      run: |
        wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
        echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
        sudo apt update && sudo apt install terraform=1.3.0
 
    - name: install tflint
      run: curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
 
    - name: lint terraform code
      run: scripts/tflint.sh
 

What changed

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow