Github Actions Matrix include entries conditionally based on GitHub Events

The matrix solution looks like this for your example:

name: Terraform Apply
on:
  push:
    inputs:
      environment:
        description: "name of the environment"
        required: true
        default: "dev"

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        environment: [dev, dev-midwest, prod-east, prod-midwest]
    steps:
      - name: Deploy
        if: ${{ github.event.inputs.environment == 'all' || (matrix.environment == github.event.inputs.environment) }}
        shell: bash
        run: |
          echo "Hello World !!! ${{ matrix.environment }}"