terraform-provider-tfe icon indicating copy to clipboard operation
terraform-provider-tfe copied to clipboard

Support specifying Slack channel in tfe_notification_configuration

Open anthonyangel opened this issue 3 years ago • 4 comments

For Slack the tfe_notification_configuration resource takes in a webhook URL, and sends messages to the default channel which was configured when the webhook was set up (in Slack) - it would be useful to be able to override the channel within the resource

anthonyangel avatar Nov 05 '20 09:11 anthonyangel

It would be possible to specify a channel override for a particular slack notification config, but I think it would introduce a bit of uncertainty since the channel is defined on both ends of the webhook. Furthermore, since Slack ultimately manages the channels (and channel names can be renamed/archived/etc) I think it makes more sense to define the channel on the Slack webhook and create more webhooks as needed, rather than have to potentially synchronize it with Terraform Cloud.

Having said all that, I've noted this internally as a feature request on the Terraform Cloud API itself rather than the provider, since the API does not allow other distribution-specific options.

brandonc avatar Dec 22 '22 17:12 brandonc

@brandonc I'm not sure why this is closed as completed, rather than waiting on API support, but I wanted to put in my 2c about why I think this is important.

As a platform engineer, I want to enable developer teams working on a new project to be able to self-service quickly set up a new project. One of the components of a new project is a set of Terraform Cloud workspaces, and ideally a Slack channel that can agglomerate the different sources of automatic notifications that are generated by that project.

Currently there is no public Terraform provider (at least on the Terraform Registry) that supports programmatically creating a Slack webhook. To configure notifications therefore requires setting up a Slack Incoming Webhook by hand. The Slack Webhook is supposed to be considered secret and not committed to version control. This can work if I pay a one-time manual setup of a single webhook URL, store it as a secret, and then change the Slack channel in tfe_notification_configuration per the channel that was created for the project. If I can't change the Slack channel per project, then I need an entirely different webhook URL per project. If I could create the Slack channel programmatically, then this would be fine. But as it stands, I would currently need to create the Slack webhook URL manually per project, store it as a secret, and then reference it in the configuration. This makes little sense compared to setting up the notification per workspace manually, if I already need to create a webhook manually.

ari-becker avatar Jan 19 '23 10:01 ari-becker

Thanks for the details! That gives a little more gas to the internal feature request. This needs to be a feature of the platform before I can add support to the provider.

brandonc avatar Jan 19 '23 16:01 brandonc

It was my originally my intention to close this as "not planned" but I forgot to choose that option. I will keep this feature request open until I find out if/when it could be added to the notification configurations API

brandonc avatar Jan 19 '23 16:01 brandonc