Enable `Build when pull requests become ready for review` using Terraform?

Hi!

I was wondering if it is possible to enable Build when pull requests become ready for review using Terraform/the Buildkite API? I don’t think I’m seeing it in Terraform Registry or in Pipelines API | Buildkite Documentation

Thanks!
Patrik

Hey Patrik,

Thanks for the message.

I went through this and also was not able to find build_pull_request_ready_for_review listed as an optional attribute for the provider settings docs. We probably need to update the docs on both ends.

https://registry.terraform.io/providers/buildkite/buildkite/latest/docs/resources/pipeline#provider-settings-configuration

Its default when not set is false. I was able to set the value you needed by using

provider_settings {
    build_pull_request_ready_for_review = true
  }

Cheers!

Hello @Patrik!

Provider maintainer here :wave:

As @stephanie.atte mentioned, we’ll look into getting the docs aligned: but maintaining a pipeline with PRs ready for review is supported by the provider: you’ll note its part of the pipeline’s schema under the provider_settings block as build_pull_request_ready_for_review (note it’s only available for pipelines using GitHub).

To use it, you’d need to either create a new pipeline resource (or amend an existing one) like below: you’ll need trigger_mode set as "code" - and bothbuild_pull_requests/build_pull_request_ready_for_review set as true:

resource "buildkite_pipeline" "frontend-app" {
    name = "Frontend app"
    repository = "git@github.com:my-great-org/my-great-repo.git" 
    provider_settings {
      trigger_mode = "code"
      build_pull_requests = true
      build_pull_request_ready_for_review = true
    }
}

Which applies the config as below :

Hope that helps!

Thank you both! That is great news!