launchdarkly / terraform-provider-launchdarkly

Terraform LaunchDarkly provider
https://www.terraform.io/docs/providers/launchdarkly/
Mozilla Public License 2.0
23 stars 24 forks source link

Add slack webhook resource #16

Closed h-aboyd closed 2 years ago

h-aboyd commented 4 years ago

Hi!

I'm trying to use the following resource: https://www.terraform.io/docs/providers/launchdarkly/r/webhook.html

In the LaunchDarkly UI, you can attach an optional policy document to webhooks, but on the terraform resource you cannot (As the docs show it missing, and terraform will error with An argument named "policy" is not expected here.).

Ideally, I could do something like this:

resource "launchdarkly_webhook" "example" {
    url = "..."
    name = "..."
    enabled = true
    policy = "${file("policy.json")}"
}

Also, will this resource (launchdarkly_webhook) work for Slack webhooks?

ldhenry commented 4 years ago

Hi @h-aboyd,

This was an implementation oversight that we should be able to address in the near future. Likely we will use the same policy schema described in the launchdarkly_custom_role documentation. Unfortunately Slack webhooks will likely require a new resource but it shouldn't be too much trouble to implement. I've filed internal tickets to address both of the webhook policy and the Slack webhooks resource and I'll be sure to update this ticket once the new features are released.

Thanks, Henry

ldhenry commented 4 years ago

Hi @h-aboyd,

I just released v1.2.0 of the provider which contains policy_statements for webhooks. See the updated documentation for usage details.

I'll keep this issue open since I still plan on implementing the Slack webhooks resource

h-aboyd commented 4 years ago

Hey @ldhenry! Thanks for the update! Will keep an eye out for the slack webhook resource.

ldhenry commented 2 years ago

Hey @h-aboyd,

I know it's been a while, but I wanted to let you know that we just released v2.5.0 of the provider which includes support for managing Slack webhooks using the launchdarkly_audit_log_subscription resource.

To manage a Slack webhook configuration you'll want to do something similar to the following:

resource "launchdarkly_audit_log_subscription" "example" {
    integration_key = "slack"
    name = "Example Slack Webhooks Subscription"
    config {
        url = "https://hooks.slack.com/YOUR-UNIQUE-URL"
    }
    tags = [
        "integrations",
        "terraform"
    ]
    statements {
        actions = ["*"]
        effect = "allow"
        resources = ["proj/*:env/*:flag/*"]
    }
}

Cheers, Henry