@@ -56,13 +56,13 @@ func resourceGitlabBranchProtectionCreate(d *schema.ResourceData, meta interface
56
56
branch := gitlab .String (d .Get ("branch" ).(string ))
57
57
mergeAccessLevel := accessLevelID [d .Get ("merge_access_level" ).(string )]
58
58
pushAccessLevel := accessLevelID [d .Get ("push_access_level" ).(string )]
59
- codeOwnerApprovalRequired := getOptionalBool ( d , "code_owner_approval_required" )
59
+ codeOwnerApprovalRequired := d . Get ( "code_owner_approval_required" ).( bool )
60
60
61
61
options := & gitlab.ProtectRepositoryBranchesOptions {
62
62
Name : branch ,
63
63
MergeAccessLevel : & mergeAccessLevel ,
64
64
PushAccessLevel : & pushAccessLevel ,
65
- CodeOwnerApprovalRequired : codeOwnerApprovalRequired ,
65
+ CodeOwnerApprovalRequired : & codeOwnerApprovalRequired ,
66
66
}
67
67
68
68
log .Printf ("[DEBUG] create gitlab branch protection on %v for project %s" , options .Name , project )
@@ -120,12 +120,12 @@ func resourceGitlabBranchProtectionUpdate(d *schema.ResourceData, meta interface
120
120
client := meta .(* gitlab.Client )
121
121
project := d .Get ("project" ).(string )
122
122
branch := d .Get ("branch" ).(string )
123
- codeOwnerApprovalRequired := getOptionalBool ( d , "code_owner_approval_required" )
123
+ codeOwnerApprovalRequired := d . Get ( "code_owner_approval_required" ).( bool )
124
124
125
125
log .Printf ("[DEBUG] update gitlab branch protection for project %s, branch %s" , project , branch )
126
126
127
127
options := & gitlab.RequireCodeOwnerApprovalsOptions {
128
- CodeOwnerApprovalRequired : codeOwnerApprovalRequired ,
128
+ CodeOwnerApprovalRequired : & codeOwnerApprovalRequired ,
129
129
}
130
130
131
131
if _ , err := client .ProtectedBranches .RequireCodeOwnerApprovals (project , branch , options ); err != nil {
0 commit comments