The Harness Terraform provider does not support adding multiple mandatory reviewer teams to a single branch — the default reviewers' field is unavailable in the provider.
My team would like to have the ability to add multiple team names to a branch_rule.
The REST API does support injecting default reviewers directly into the pull request object. I traced this back to the specific line in the provider's source where the PR object is instantiated.
rule.Pullreq = &code.ProtectionDefPullReq{
Approvals: &code.ProtectionDefApprovals{
RequireCodeOwners: rules["require_code_owners"].(bool),
RequireLatestCommit: rules["require_latest_commit_approval"].(bool),
RequireMinimumCount: int32(rules["require_minimum_approval_count"].(int)),
RequireNoChangeRequest: rules["require_no_change_request"].(bool),
},
Comments: &code.ProtectionDefComments{
RequireResolveAll: rules["require_resolve_all_comments"].(bool),
},
Merge: &code.ProtectionDefMerge{
DeleteBranch: rules["delete_branch_on_merge"].(bool),
StrategiesAllowed: mergeMethod,
},
StatusChecks: &code.ProtectionDefStatusChecks{
RequireIdentifiers: convertSliceToString(rules["require_status_checks"].([]interface{})),
},
}
Here, we can add the reviewers struct to be added to the payload, in order for it to be included to the json payload when submitting a request to https://app.harness.io/code/api/v1/repos/{repo_identifier}/rules.
"reviewers": {
"default_reviewer_ids": [
0
],
"default_user_group_reviewer_ids": [
0
],
"request_code_owners": true
},
The Harness Terraform provider does not support adding multiple mandatory reviewer teams to a single branch — the default reviewers' field is unavailable in the provider.
My team would like to have the ability to add multiple team names to a
branch_rule.The REST API does support injecting default reviewers directly into the pull request object. I traced this back to the specific line in the provider's source where the PR object is instantiated.
Here, we can add the
reviewersstruct to be added to the payload, in order for it to be included to the json payload when submitting a request to https://app.harness.io/code/api/v1/repos/{repo_identifier}/rules.