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

**URL:** <https://forum.buildkite.community/t/enable-build-when-pull-requests-become-ready-for-review-using-terraform/3236>\
**Category:** Pipelines\
**Created:** [September 6, 2023, 5:48pm UTC](https://forum.buildkite.community/t/enable-build-when-pull-requests-become-ready-for-review-using-terraform/3236 "2023-09-06T17:48:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrik](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/patrik/32/1187_2.png) [@Patrik](https://forum.buildkite.community/u/Patrik)\
**Post date:** [September 6, 2023, 5:48pm UTC](https://forum.buildkite.community/t/enable-build-when-pull-requests-become-ready-for-review-using-terraform/3236/1 "2023-09-06T17:48:05Z")

</div>

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](https://registry.terraform.io/providers/buildkite/buildkite/latest/docs/resources/pipeline#provider-settings-configuration) or in [Pipelines API | Buildkite Documentation](https://buildkite.com/docs/apis/rest-api/pipelines#provider-settings-properties)

Thanks!  
Patrik

---

<div class="post-metadata">

**Author:** ![stephanie.atte](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/stephanie.atte/32/1357_2.png) [@stephanie.atte](https://forum.buildkite.community/u/stephanie.atte)\
**Post date:** [September 6, 2023, 6:36pm UTC](https://forum.buildkite.community/t/enable-build-when-pull-requests-become-ready-for-review-using-terraform/3236/2 "2023-09-06T18:36:29Z")

</div>

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](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

```auto
provider_settings {
    build_pull_request_ready_for_review = true
  }

```

Cheers!

---

<div class="post-metadata">

**Author:** ![james.s](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/james.s/32/1305_2.png) [@james.s](https://forum.buildkite.community/u/james.s)\
**Post date:** [September 6, 2023, 10:12pm UTC](https://forum.buildkite.community/t/enable-build-when-pull-requests-become-ready-for-review-using-terraform/3236/3 "2023-09-06T22:12:33Z")

</div>

Hello @Patrik!

Provider maintainer here 👋

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](https://github.com/buildkite/terraform-provider-buildkite/blob/main/buildkite/resource_pipeline.go#L585-L593) 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 both`build_pull_requests`/`build_pull_request_ready_for_review` set as `true`:

```auto
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 :

 ![image](https://us1.discourse-cdn.com/flex016/uploads/buildkite1/original/2X/5/51abbd6aff5b6d86d17a0b3d4352674dc0c2aa39.png)

Hope that helps!

---

<div class="post-metadata">

**Author:** ![Patrik](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/patrik/32/1187_2.png) [@Patrik](https://forum.buildkite.community/u/Patrik)\
**Post date:** [September 7, 2023, 5:13pm UTC](https://forum.buildkite.community/t/enable-build-when-pull-requests-become-ready-for-review-using-terraform/3236/4 "2023-09-07T17:13:38Z")

</div>

Thank you both! That is great news!
