terraform-provider-github: Unable to set branch names/patterns when `custom_branch_policies` is `true`.
Affected Resource(s)
- github_repository_environment
Terraform Configuration Files
resource "github_repository_environment" "environment" {
repository = "repository_name"
environment = "testing"
deployment_branch_policy {
protected_branches = false
custom_branch_policies = true
}
}
In the GitHub console, when custom_branch_policies is set to true, it allows setting one or more Branch names/patterns to match against. It doesn’t seem like this is possible in Terraform. I’m unable to find any other GitHub resource that would allow managing that list per environment. Am I missing something?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 37
- Comments: 17 (6 by maintainers)
The API document specify the following:
So I guess this makes it hard to be added to the terraform module.
Would really like to see this implemented. Having a custom_branch_policies attribute feels a bit misleading since it’s only a bool.
If that’s true, that’s great news. I’d be happy to review/test/merge a PR to cover this behavior!
Great to see a PR near being merged for this, definitely a very desired feature! Thank you
@kfcampbell then I may give it a try as soon as the afk is released.
Disclaimer: I am not really expert in go though but with copy paste and some help from the PR review I should be able to land this
I added a comment in GitHub’s product discussions to try to elevate this to their PM team: https://github.com/github-community/community/discussions/14190#discussioncomment-3065590
https://github.com/orgs/community/discussions/14190#discussioncomment-3931426 points to https://docs.github.com/en/rest/deployments/branch-policies#create-a-deployment-branch-policy, which suggests that there is now an API endpoint for this.