kelvintaywl / terraform-provider-circleci

(Unofficial) Terraform Provider for CircleCI
https://registry.terraform.io/providers/kelvintaywl/circleci/latest
Mozilla Public License 2.0
12 stars 3 forks source link

Update Webhook resource to accept `project_slug` #23

Closed kelvintaywl closed 1 year ago

kelvintaywl commented 1 year ago

Currently, the Webhook resource accepts a project_id attribute, to link to its project.

The other resources, like Schedule, Checkout Key, and Project Environment Variables all accept the project_slug attribute. Hence, it would be a nice-to-have if Webhook resource can also follow this, for consistency.

Right now, this can be solved trivially within Terraform via the Project data source.

You can thus do the following:

data "circleci_project" "my_project" {
  slug = "github/acmeorg/foobar"
}

resource "circleci_webhook" "my_webhook" {
  project_id     = data.circleci_project.my_project.id
  name           = "my_webhook"
  url            = "https://example.com/hook"
  signing_secret = "5uperSeCr3t!"
  verify_tls     = true
  events = [
    // accepts only "workflow-completed" and "job-completed"
    "job-completed",
    "workflow-completed"
  ]
}
kelvintaywl commented 1 year ago

I've decided not to support this, since the project ID can still be retrieved via the circleci_project data source: https://registry.terraform.io/providers/kelvintaywl/circleci/latest/docs/data-sources/project

will be happy to reopen this if this is widely needed / requested