@@ -1139,6 +1139,49 @@ 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
+ rInt := acctest .RandInt ()
1146
+
1147
+ resource .Test (t , resource.TestCase {
1148
+ ProviderFactories : providerFactories ,
1149
+ CheckDestroy : testAccCheckGitlabProjectDestroy ,
1150
+ Steps : []resource.TestStep {
1151
+ // Create minimal test project
1152
+ {
1153
+ Config : fmt .Sprintf (`
1154
+ resource "gitlab_project" "this" {
1155
+ name = "foo-%d"
1156
+ visibility_level = "public"
1157
+ analytics_access_level = "private"
1158
+ }` , rInt ),
1159
+ },
1160
+ // Verify Import
1161
+ {
1162
+ ResourceName : "gitlab_project.this" ,
1163
+ ImportState : true ,
1164
+ ImportStateVerify : true ,
1165
+ },
1166
+ // Update `analytics_access_level`
1167
+ {
1168
+ Config : fmt .Sprintf (`
1169
+ resource "gitlab_project" "this" {
1170
+ name = "foo-%d"
1171
+ visibility_level = "public"
1172
+ analytics_access_level = "disabled"
1173
+ }` , rInt ),
1174
+ },
1175
+ // Verify Import
1176
+ {
1177
+ ResourceName : "gitlab_project.this" ,
1178
+ ImportState : true ,
1179
+ ImportStateVerify : true ,
1180
+ },
1181
+ },
1182
+ })
1183
+ }
1184
+
1142
1185
func TestAccGitlabProject_containerExpirationPolicy (t * testing.T ) {
1143
1186
var received gitlab.Project
1144
1187
rInt := acctest .RandInt ()
0 commit comments