Skip to content

feat: Add create_webhook attribute to buildkite_pipeline resource - #1019

Draft
lox wants to merge 3 commits into
mainfrom
lachlan/create-webhook-attribute
Draft

feat: Add create_webhook attribute to buildkite_pipeline resource#1019
lox wants to merge 3 commits into
mainfrom
lachlan/create-webhook-attribute

Conversation

@lox

@lox lox commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the ability to automatically create a GitHub webhook when creating a pipeline, leveraging the GitHub App integration. This eliminates the need for users to have repo admin access or manually create webhooks.

Context

Customer feedback requested IaC support for automatic webhook creation. This depends on a corresponding backend change to the Buildkite GraphQL API that adds the createWebhook input field to the pipelineCreate mutation.

Note: This PR is a draft until the backend changes are deployed.

Changes

buildkite/resource_pipeline.go

  • Add create_webhook input attribute (optional, defaults to false)
  • Add webhook_created computed attribute
  • Pass createWebhook to the GraphQL mutation
  • Preserve values through Update lifecycle

buildkite/graphql/pipeline.graphql

  • Add createWebhook to the mutation input
  • Request webhookCreated in the response

schema.graphql

  • Add createWebhook input field and webhookCreated output field (will be regenerated from API once backend is deployed)

examples/resources/buildkite_pipeline/resource.tf

  • Add example showing create_webhook = true usage

Verification

  • go build passes
  • End-to-end testing pending backend deployment

Example

resource "buildkite_pipeline" "example" {
  name           = "my-pipeline"
  repository     = "git@github.com:org/repo.git"
  cluster_id     = data.buildkite_cluster.default.id
  create_webhook = true
}

Before Merging

  1. Backend changes must be deployed
  2. Regenerate schema: make schema generate
  3. Run acceptance tests

Adds the ability to automatically create a GitHub webhook when creating a
pipeline, leveraging the GitHub App integration. This eliminates the need
for users to have repo admin access or manually create webhooks.

New attributes:
- create_webhook: If true, creates a webhook on the repository (default: false)
- webhook_created: Computed field indicating if webhook creation succeeded

This requires the corresponding backend changes in buildkite/buildkite
(PR #27467) to be deployed first.

Example usage:
  resource "buildkite_pipeline" "example" {
    name           = "my-pipeline"
    repository     = "git@github.com:org/repo.git"
    create_webhook = true
  }

Amp-Thread-ID: https://ampcode.com/threads/T-019c012f-bc4f-7455-a3b1-0d8ab940a3e8
@lox
lox requested a review from a team as a code owner January 28, 2026 10:10
@lox
lox marked this pull request as draft January 28, 2026 10:11

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 178c2e14f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread buildkite/resource_pipeline.go
lox added 2 commits January 29, 2026 07:13
- Add RequiresReplace() plan modifier to create_webhook since it only works at creation
- Set webhook_created to null when create_webhook is false
- Add warning diagnostic when webhook creation fails

Amp-Thread-ID: https://ampcode.com/threads/T-019c012f-bc4f-7455-a3b1-0d8ab940a3e8
@lox
lox force-pushed the lachlan/create-webhook-attribute branch from 1849e70 to f1106a1 Compare January 28, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant