tfnotify
tfnotify copied to clipboard
Conditional notification
I'd like to notify terraform cmd result to slack only when it fails. I think we can implement it as a conditional notification function, like below:
---
ci: circleci
notifier:
slack:
token: $SLACK_TOKEN
channel: $SLACK_CHANNEL_ID
bot: $SLACK_BOT_NAME
terraform:
plan:
filters:
only:
- failed # notify when terraform-plan failed
template: |
{{ .Message }}
{{if .Result}}
```
{{ .Result }}
```
{{end}}
```
{{ .Body }}
```
Do you have any opinion? And I try to implement a patch as PoC if you have no problem.
@syucream Thank you for your suggestion.
It's good idea! (I thought that it should be implemented in the near future 😉) But YAML (struct) format should seem to be considered a bit more.
And I try to implement a patch as PoC if you have no problem.
👍