Skip to content

Commit

Permalink
- Updated template for mattermost in example
Browse files Browse the repository at this point in the history
- Enabled Markdown in payload

- Added screenshot for Mattermost message
  • Loading branch information
Leon Silcott committed Oct 30, 2022
1 parent eefd410 commit 53ac740
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 17 deletions.
69 changes: 52 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ You can do this by using this command.

<img src="./misc/images/3.png" width="600">

<img src="./misc/images/4.png" width="500">

## Installation

Grab the binary from GitHub Releases (Recommended)
Expand Down Expand Up @@ -328,39 +330,72 @@ notifier:
terraform:
fmt:
template: |
{{ .Title }}
{{if .Message}}**`Message`**: {{ .Message }}{{end}}
**`Context`**: [*(Click me) Explore the change(s) further*]( {{ .Link }} )

{{if .Result}}
## Result
```
{{ .Result }}
```
{{end}}

{{ .Message }}
## Details

{{ .Result }}
View the summary below

```
{{ .Body }}
```

plan:
template: |
{{ .Title }} <sup>[CI link]( {{ .Link }} )</sup>
{{ .Message }}
{{if .Message}}**`Message`**: {{ .Message }}{{end}}
**`Context`**: [*(Click me) Explore the change(s) further*]( {{ .Link }} )
{{if .Result}}
<pre><code>{{ .Result }}
</pre></code>
## Result
```
{{ .Result }}
```
{{end}}
<details><summary>Details (Click me)</summary>
<pre><code>{{ .Body }}
</pre></code></details>
## Details
View the summary below
```
{{ .Body }}
```
when_destroy:
template: |
## :warning: WARNING: Resource Deletion will happen :warning:
This plan contains **resource deletion**. Please check the plan result very carefully!
apply:
template: |
{{ .Title }}
{{ .Message }}
{{if .Message}}**`Message`**: {{ .Message }}{{end}}
**`Context`**: [*(Click me) Explore the change(s) further*]( {{ .Link }} )
{{if .Result}}
<pre><code>{{ .Result }}
</pre></code>
## Result
```
{{ .Result }}
```
{{end}}
<details><summary>Details (Click me)</summary>
<pre><code>{{ .Body }}
</pre></code></details>
## Details
View the summary below
```
{{ .Body }}
```
```
> Note, for `notifier.mattermost.bot` to work override, you must ensure you enable application/ webhook overrides on your Mattermost system. If you do not, the webhook will, by default, take the name of its creator. If you cannot enable application/ webhook overrides, you might have to consider creating a dedicated `tfnotify` Mattermost user account.

</details>

<details>
Expand Down
Binary file added misc/images/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions notifier/mattermost/mattermost.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func (m *Mattermost) ChatPostMessage(attachments []slack.Attachment) error {
Channel: m.Channel,
IconUrl: "https://docs.mattermost.com/_images/icon-76x76.png",
Attachments: attachments,
Markdown: true,
}

errs := slack.Send(m.Webhook, "", payload)
Expand Down

0 comments on commit 53ac740

Please sign in to comment.