From 86828a354b0f89da9959572decc4d70edb8f1712 Mon Sep 17 00:00:00 2001 From: Frank Klaassen <639906+syphernl@users.noreply.github.com> Date: Tue, 4 Jan 2022 13:20:13 +0100 Subject: [PATCH 1/2] docs: add docs for slack integration --- runatlantis.io/docs/using-slack-hooks.md | 46 ++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 runatlantis.io/docs/using-slack-hooks.md diff --git a/runatlantis.io/docs/using-slack-hooks.md b/runatlantis.io/docs/using-slack-hooks.md new file mode 100644 index 0000000000..89fa8d7c58 --- /dev/null +++ b/runatlantis.io/docs/using-slack-hooks.md @@ -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. From 7e584e9e5d2ac8b11d68a5517d1c8c1d316c3267 Mon Sep 17 00:00:00 2001 From: Frank Klaassen <639906+syphernl@users.noreply.github.com> Date: Tue, 4 Jan 2022 13:27:01 +0100 Subject: [PATCH 2/2] add menu --- runatlantis.io/.vuepress/config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runatlantis.io/.vuepress/config.js b/runatlantis.io/.vuepress/config.js index ecb708105b..8a7eb49bf7 100644 --- a/runatlantis.io/.vuepress/config.js +++ b/runatlantis.io/.vuepress/config.js @@ -72,7 +72,8 @@ module.exports = { 'apply-requirements', 'checkout-strategy', 'terraform-versions', - 'terraform-cloud' + 'terraform-cloud', + 'using-slack-hooks' ] }, {