@@ -20,15 +20,15 @@ func TestAccSqlUser_mysql(t *testing.T) {
20
20
CheckDestroy : testAccSqlUserDestroyProducer (t ),
21
21
Steps : []resource.TestStep {
22
22
{
23
- Config : testGoogleSqlUser_mysql (instance , "password" , false ),
23
+ Config : testGoogleSqlUser_mysql (instance , "password" ),
24
24
Check : resource .ComposeTestCheckFunc (
25
25
testAccCheckGoogleSqlUserExists (t , "google_sql_user.user1" ),
26
26
testAccCheckGoogleSqlUserExists (t , "google_sql_user.user2" ),
27
27
),
28
28
},
29
29
{
30
30
// Update password
31
- Config : testGoogleSqlUser_mysql (instance , "new_password" , false ),
31
+ Config : testGoogleSqlUser_mysql (instance , "new_password" ),
32
32
Check : resource .ComposeTestCheckFunc (
33
33
testAccCheckGoogleSqlUserExists (t , "google_sql_user.user1" ),
34
34
testAccCheckGoogleSqlUserExists (t , "google_sql_user.user2" ),
@@ -45,40 +45,6 @@ func TestAccSqlUser_mysql(t *testing.T) {
45
45
})
46
46
}
47
47
48
- func TestAccSqlUser_mysqlDisabled (t * testing.T ) {
49
- t .Parallel ()
50
-
51
- instance := fmt .Sprintf ("i-%d" , randInt (t ))
52
- vcrTest (t , resource.TestCase {
53
- PreCheck : func () { testAccPreCheck (t ) },
54
- Providers : testAccProviders ,
55
- CheckDestroy : testAccSqlUserDestroyProducer (t ),
56
- Steps : []resource.TestStep {
57
- {
58
- Config : testGoogleSqlUser_mysql (instance , "password" , true ),
59
- },
60
- {
61
- ResourceName : "google_sql_user.user1" ,
62
- ImportStateId : fmt .Sprintf ("%s/%s/gmail.com/admin" , getTestProjectFromEnv (), instance ),
63
- ImportState : true ,
64
- ImportStateVerify : true ,
65
- ImportStateVerifyIgnore : []string {"password" },
66
- },
67
- {
68
- // Update password
69
- Config : testGoogleSqlUser_mysql (instance , "password" , false ),
70
- },
71
- {
72
- ResourceName : "google_sql_user.user1" ,
73
- ImportStateId : fmt .Sprintf ("%s/%s/gmail.com/admin" , getTestProjectFromEnv (), instance ),
74
- ImportState : true ,
75
- ImportStateVerify : true ,
76
- ImportStateVerifyIgnore : []string {"password" },
77
- },
78
- },
79
- })
80
- }
81
-
82
48
func TestAccSqlUser_iamUser (t * testing.T ) {
83
49
// Multiple fine-grained resources
84
50
skipIfVcr (t )
@@ -291,15 +257,15 @@ func TestAccSqlUser_mysqlPasswordPolicy(t *testing.T) {
291
257
CheckDestroy : testAccSqlUserDestroyProducer (t ),
292
258
Steps : []resource.TestStep {
293
259
{
294
- Config : testGoogleSqlUser_mysqlPasswordPolicy (instance , "password" , false ),
260
+ Config : testGoogleSqlUser_mysqlPasswordPolicy (instance , "password" ),
295
261
Check : resource .ComposeTestCheckFunc (
296
262
testAccCheckGoogleSqlUserExists (t , "google_sql_user.user1" ),
297
263
testAccCheckGoogleSqlUserExists (t , "google_sql_user.user2" ),
298
264
),
299
265
},
300
266
{
301
267
// Update password
302
- Config : testGoogleSqlUser_mysqlPasswordPolicy (instance , "new_password" , false ),
268
+ Config : testGoogleSqlUser_mysqlPasswordPolicy (instance , "new_password" ),
303
269
Check : resource .ComposeTestCheckFunc (
304
270
testAccCheckGoogleSqlUserExists (t , "google_sql_user.user1" ),
305
271
testAccCheckGoogleSqlUserExists (t , "google_sql_user.user2" ),
@@ -316,7 +282,7 @@ func TestAccSqlUser_mysqlPasswordPolicy(t *testing.T) {
316
282
})
317
283
}
318
284
319
- func testGoogleSqlUser_mysql (instance , password string , disabled bool ) string {
285
+ func testGoogleSqlUser_mysql (instance , password string ) string {
320
286
return fmt .Sprintf (`
321
287
resource "google_sql_database_instance" "instance" {
322
288
name = "%s"
@@ -333,23 +299,18 @@ resource "google_sql_user" "user1" {
333
299
instance = google_sql_database_instance.instance.name
334
300
host = "google.com"
335
301
password = "%s"
336
- sql_server_user_details {
337
- disabled = "%t"
338
- server_roles = [ "admin" ]
339
- }
340
302
}
341
303
342
304
resource "google_sql_user" "user2" {
343
305
name = "admin"
344
306
instance = google_sql_database_instance.instance.name
345
307
host = "gmail.com"
346
308
password = "hunter2"
347
- depends_on = [google_sql_user.user1]
348
309
}
349
- ` , instance , password , disabled )
310
+ ` , instance , password )
350
311
}
351
312
352
- func testGoogleSqlUser_mysqlPasswordPolicy (instance , password string , disabled bool ) string {
313
+ func testGoogleSqlUser_mysqlPasswordPolicy (instance , password string ) string {
353
314
return fmt .Sprintf (`
354
315
resource "google_sql_database_instance" "instance" {
355
316
name = "%s"
@@ -366,10 +327,7 @@ resource "google_sql_user" "user1" {
366
327
instance = google_sql_database_instance.instance.name
367
328
host = "google.com"
368
329
password = "%s"
369
- sql_server_user_details {
370
- disabled = "%t"
371
- server_roles = [ "admin" ]
372
- }
330
+
373
331
password_policy {
374
332
allowed_failed_attempts = 6
375
333
password_expiration_duration = "2592000s"
@@ -388,7 +346,7 @@ resource "google_sql_user" "user2" {
388
346
enable_failed_attempts_check = true
389
347
}
390
348
}
391
- ` , instance , password , disabled )
349
+ ` , instance , password )
392
350
}
393
351
394
352
func testGoogleSqlUser_postgres (instance , password string ) string {
0 commit comments