github-terraform-plan-slack-action

GitHub Action for sending terraform plan result to a Slack channel.

MIT License

Stars
2

github-terraform-plan-slack-action

GitHub Action for sending terraform plan result to a Slack channel.

  • Shows summary of the affected resources
  • Click here
    link to easily jump to the full plan log

Inputs

Name Description Required Default
plan-job Job name where terraform plan has been run Yes N/A
plan-step Step name where terraform plan has been run Yes N/A
plan-index Index number if multiple plans have run No 0
workspace Terraform workspace name No N/A
github-token GitHub token No ${{ env.GITHUB_TOKEN }} or ${{ github.token }}
channel Slack channel name No (*1) N/A
slack-bot-token Slack bot token No (*1) ${{ env.SLACK_BOT_TOKEN }}
slack-webhook-url Slack webhook URL No (*1) ${{ env.SLACK_WEBHOOK_URL }}
  1. Need to specify channel and slack-bot-token both or slack-webhook-url.

Outputs

Name Description
should-apply true if terraform apply is needed, otherwise false
should-refresh true if terraform refresh is needed, otherwise false

Usage

Use this action after the job where you run terraform plan.


  plan:
    runs-on: ubuntu-latest
    steps:
      # ... other steps
      
      - name: Run terraform plan
        run: terraform plan

  after-plan:
    runs-on: ubuntu-latest
    needs:
      - plan
    steps:
      - name: Notify terraform plan result to the Slack channel
        uses: kota65535/github-terraform-plan-slack-action@v1
        with:
          plan-job: plan
          plan-step: Run terraform plan
          channel: my-ci
          slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
Package Rankings
Top 25.79% on Github actions