@@ -53,10 +53,10 @@ func resourceGithubTeamSettings() *schema.Resource {
5353 ValidateDiagFunc : validation .ToDiagFunc (validation .StringInSlice ([]string {string (githubv4 .TeamReviewAssignmentAlgorithmRoundRobin ), string (githubv4 .TeamReviewAssignmentAlgorithmLoadBalance )}, false )),
5454 },
5555 "member_count" : {
56- Type : schema .TypeInt ,
57- Optional : true ,
58- RequiredWith : [] string { "review_request_delegation" } ,
59- Description : "The number of team members to assign to a pull request." ,
56+ Type : schema .TypeInt ,
57+ Optional : true ,
58+ Default : 1 ,
59+ Description : "The number of team members to assign to a pull request." ,
6060 ValidateDiagFunc : validation .ToDiagFunc (validation .All (
6161 validation .IntAtLeast (1 ),
6262 )),
@@ -112,6 +112,13 @@ func resourceGithubTeamSettingsCreate(ctx context.Context, d *schema.ResourceDat
112112 } `graphql:"updateTeamReviewAssignment(input:$input)"`
113113 }
114114
115+ tflog .Debug (ctx , "Review request delegation settings" , map [string ]any {
116+ "team_id" : d .Id (),
117+ "team_slug" : slug ,
118+ "review_request_delegation" : reviewRequestDelegation ,
119+ "length_of_settings" : len (reviewRequestDelegation ),
120+ })
121+
115122 if len (reviewRequestDelegation ) == 0 {
116123 tflog .Debug (ctx , "No review request delegation settings provided, disabling review request delegation" , map [string ]any {
117124 "team_id" : d .Id (),
@@ -123,6 +130,11 @@ func resourceGithubTeamSettingsCreate(ctx context.Context, d *schema.ResourceDat
123130 return diag .FromErr (err )
124131 }
125132 } else {
133+ tflog .Debug (ctx , "Review request delegation settings provided, setting according to provided configuration" , map [string ]any {
134+ "team_id" : d .Id (),
135+ "team_slug" : slug ,
136+ "review_request_delegation" : reviewRequestDelegation ,
137+ })
126138 settings := reviewRequestDelegation [0 ].(map [string ]any )
127139
128140 teamReviewAlgorithm := githubv4 .TeamReviewAssignmentAlgorithm (settings ["algorithm" ].(string ))
@@ -133,6 +145,7 @@ func resourceGithubTeamSettingsCreate(ctx context.Context, d *schema.ResourceDat
133145 TeamMemberCount : githubv4 .NewInt (githubv4 .Int (settings ["member_count" ].(int ))),
134146 NotifyTeam : githubv4 .NewBoolean (githubv4 .Boolean (settings ["notify" ].(bool ))),
135147 }
148+
136149 err := graphql .Mutate (ctx , & mutation , updateTeamReviewAssignmentInput , nil )
137150 if err != nil {
138151 return diag .FromErr (err )
0 commit comments