@@ -1395,40 +1395,6 @@ func TestAccSqlDatabaseInstance_Timezone(t *testing.T) {
1395
1395
})
1396
1396
}
1397
1397
1398
- func TestAccSqlDatabaseInstance_mysqlMajorVersionUpgrade (t * testing.T ) {
1399
- t .Parallel ()
1400
-
1401
- databaseName := "tf-test-" + randString (t , 10 )
1402
-
1403
- vcrTest (t , resource.TestCase {
1404
- PreCheck : func () { testAccPreCheck (t ) },
1405
- Providers : testAccProviders ,
1406
- CheckDestroy : testAccSqlDatabaseInstanceDestroyProducer (t ),
1407
- Steps : []resource.TestStep {
1408
- {
1409
- Config : fmt .Sprintf (
1410
- testGoogleSqlDatabaseInstance_basic3 , databaseName ),
1411
- },
1412
- {
1413
- ResourceName : "google_sql_database_instance.instance" ,
1414
- ImportState : true ,
1415
- ImportStateVerify : true ,
1416
- ImportStateVerifyIgnore : []string {"root_password" , "deletion_protection" },
1417
- },
1418
- {
1419
- Config : fmt .Sprintf (
1420
- testGoogleSqlDatabaseInstance_basic3_update , databaseName ),
1421
- },
1422
- {
1423
- ResourceName : "google_sql_database_instance.instance" ,
1424
- ImportState : true ,
1425
- ImportStateVerify : true ,
1426
- ImportStateVerifyIgnore : []string {"root_password" , "deletion_protection" },
1427
- },
1428
- },
1429
- })
1430
- }
1431
-
1432
1398
func TestAccSqlDatabaseInstance_sqlMysqlInstancePvpExample (t * testing.T ) {
1433
1399
t .Parallel ()
1434
1400
@@ -1526,6 +1492,65 @@ func TestAccSqlDatabaseInstance_rootPasswordShouldBeUpdatable(t *testing.T) {
1526
1492
})
1527
1493
}
1528
1494
1495
+ func TestAccSqlDatabaseInstance_activationPolicy (t * testing.T ) {
1496
+ t .Parallel ()
1497
+
1498
+ instanceName := "tf-test-" + randString (t , 10 )
1499
+
1500
+ vcrTest (t , resource.TestCase {
1501
+ PreCheck : func () { testAccPreCheck (t ) },
1502
+ Providers : testAccProviders ,
1503
+ CheckDestroy : testAccSqlDatabaseInstanceDestroyProducer (t ),
1504
+ Steps : []resource.TestStep {
1505
+ {
1506
+ Config : testGoogleSqlDatabaseInstance_activationPolicy (instanceName , "MYSQL_5_7" , "ALWAYS" , true ),
1507
+ },
1508
+ {
1509
+ ResourceName : "google_sql_database_instance.instance" ,
1510
+ ImportState : true ,
1511
+ ImportStateVerify : true ,
1512
+ ImportStateVerifyIgnore : []string {"deletion_protection" , "root_password" },
1513
+ },
1514
+ {
1515
+ Config : testGoogleSqlDatabaseInstance_activationPolicy (instanceName , "MYSQL_5_7" , "NEVER" , true ),
1516
+ },
1517
+ {
1518
+ ResourceName : "google_sql_database_instance.instance" ,
1519
+ ImportState : true ,
1520
+ ImportStateVerify : true ,
1521
+ ImportStateVerifyIgnore : []string {"deletion_protection" , "root_password" },
1522
+ },
1523
+ {
1524
+ Config : testGoogleSqlDatabaseInstance_activationPolicy (instanceName , "MYSQL_8_0_18" , "ALWAYS" , true ),
1525
+ },
1526
+ {
1527
+ ResourceName : "google_sql_database_instance.instance" ,
1528
+ ImportState : true ,
1529
+ ImportStateVerify : true ,
1530
+ ImportStateVerifyIgnore : []string {"deletion_protection" , "root_password" },
1531
+ },
1532
+ {
1533
+ Config : testGoogleSqlDatabaseInstance_activationPolicy (instanceName , "MYSQL_8_0_26" , "NEVER" , true ),
1534
+ },
1535
+ {
1536
+ ResourceName : "google_sql_database_instance.instance" ,
1537
+ ImportState : true ,
1538
+ ImportStateVerify : true ,
1539
+ ImportStateVerifyIgnore : []string {"deletion_protection" , "root_password" },
1540
+ },
1541
+ {
1542
+ Config : testGoogleSqlDatabaseInstance_activationPolicy (instanceName , "MYSQL_8_0_26" , "ALWAYS" , false ),
1543
+ },
1544
+ {
1545
+ ResourceName : "google_sql_database_instance.instance" ,
1546
+ ImportState : true ,
1547
+ ImportStateVerify : true ,
1548
+ ImportStateVerifyIgnore : []string {"deletion_protection" , "root_password" },
1549
+ },
1550
+ },
1551
+ })
1552
+ }
1553
+
1529
1554
func TestAccSqlDatabaseInstance_ReplicaPromoteSuccessful (t * testing.T ) {
1530
1555
t .Parallel ()
1531
1556
@@ -3428,3 +3453,18 @@ resource "google_sql_database_instance" "main" {
3428
3453
}
3429
3454
}` , instance , databaseVersion , rootPassword )
3430
3455
}
3456
+
3457
+ func testGoogleSqlDatabaseInstance_activationPolicy (instance , databaseVersion , activationPolicy string , deletionProtection bool ) string {
3458
+ return fmt .Sprintf (`
3459
+ resource "google_sql_database_instance" "instance" {
3460
+ name = "%s"
3461
+ region = "us-central1"
3462
+ database_version = "%s"
3463
+ deletion_protection = %t
3464
+ settings {
3465
+ tier = "db-f1-micro"
3466
+ activation_policy = "%s"
3467
+ }
3468
+ }
3469
+ ` , instance , databaseVersion , deletionProtection , activationPolicy )
3470
+ }
0 commit comments