Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: documentation for slack integration #1972

Merged
merged 2 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion runatlantis.io/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ module.exports = {
'apply-requirements',
'checkout-strategy',
'terraform-versions',
'terraform-cloud'
'terraform-cloud',
'using-slack-hooks'
]
},
{
Expand Down
46 changes: 46 additions & 0 deletions runatlantis.io/docs/using-slack-hooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Using Slack hooks

It is possible to use Slack to send notifications to your Slack channel whenever an apply is being done.

::: tip NOTE
Currently only `apply` events are supported.
:::

For this you'll need to:

* Create a Bot user in Slack
* Configure Atlantis to send notifications to Slack.

## Configuring Slack for Atlantis

* Go to [https://api.slack.com/apps](https://api.slack.com/apps)
* Click the `Create New App` button
* Select `From scratch` in the dialog that opens
* Give it a name, e.g. `atlantis-bot`.
* Select your Slack workspace
* Click `Create App`
* On the left go to `oAuth & Permissions`
* Copy the `Bot User OAuth Token` and provide it to Atlantis by using `--slack-token=xoxb-xxxxxxxxxxx` or via the environment `ATLANTIS_SLACK_TOKEN=xoxb-xxxxxxxxxxx`.
* Scroll down to scopes and add the following:
* `channels:read`
* `chat:write`
* `groups:read`
* `incoming-webhook`
* `mpim:read`
* Install the app onto your Slack workspace

## Configuring Atlantis

After following the above steps it is time to configure Atlantis. Assuming you have already provided the `slack-token` (via parameter or environment variable) you can now instruct Atlantis to send `apply` events to Slack.

In your Atlantis configuration you can now add the following:

```yaml
webhooks:
- event: apply
workspace-regex: .*
kind: slack
channel: my-channel
```

The `apply` event information will be sent to the `my-channel` Slack channel.