@@ -1139,6 +1139,56 @@ func TestAccGitlabProject_templateMutualExclusiveNameAndID(t *testing.T) {
1139
1139
})
1140
1140
}
1141
1141
1142
+ // Gitlab update project API call requires one from a subset of project fields to be set (See #1157)
1143
+ // If only a non-blessed field is changed, this test checks that the provider ensures the code won't return an error.
1144
+ func TestAccGitlabProject_UpdateAnalyticsAccessLevel (t * testing.T ) {
1145
+ var received gitlab.Project
1146
+ rInt := acctest .RandInt ()
1147
+
1148
+ resource .Test (t , resource.TestCase {
1149
+ ProviderFactories : providerFactories ,
1150
+ CheckDestroy : testAccCheckGitlabProjectDestroy ,
1151
+ Steps : []resource.TestStep {
1152
+ // Create minimal test project
1153
+ {
1154
+ Config : fmt .Sprintf (`
1155
+ resource "gitlab_project" "this" {
1156
+ name = "foo-%d"
1157
+ visibility_level = "public"
1158
+ }` , rInt ),
1159
+ Check : resource .ComposeTestCheckFunc (
1160
+ testAccCheckGitlabProjectExists ("gitlab_project.this" , & received ),
1161
+ ),
1162
+ },
1163
+ // Verify Import
1164
+ {
1165
+ ResourceName : "gitlab_project.this" ,
1166
+ ImportState : true ,
1167
+ ImportStateVerify : true ,
1168
+ },
1169
+ // Update `analytics_access_level`
1170
+ {
1171
+ Config : fmt .Sprintf (`
1172
+ resource "gitlab_project" "this" {
1173
+ name = "foo-%d"
1174
+ visibility_level = "public"
1175
+ analytics_access_level = "disabled"
1176
+ }` , rInt ),
1177
+ Check : resource .ComposeTestCheckFunc (
1178
+ testAccCheckGitlabProjectExists ("gitlab_project.this" , & received ),
1179
+ resource .TestCheckResourceAttr ("gitlab_project.this" , "analytics_access_level" , "disabled" ),
1180
+ ),
1181
+ },
1182
+ // Verify Import
1183
+ {
1184
+ ResourceName : "gitlab_project.this" ,
1185
+ ImportState : true ,
1186
+ ImportStateVerify : true ,
1187
+ },
1188
+ },
1189
+ })
1190
+ }
1191
+
1142
1192
func TestAccGitlabProject_containerExpirationPolicy (t * testing.T ) {
1143
1193
var received gitlab.Project
1144
1194
rInt := acctest .RandInt ()
0 commit comments