@@ -412,6 +412,67 @@ resource "google_sql_database_instance" "default" {
412
412
` , context )
413
413
}
414
414
415
+ func TestAccCGCSnippet_sqlMysqlInstanceReplicaExample (t * testing.T ) {
416
+ t .Parallel ()
417
+
418
+ context := map [string ]interface {}{
419
+ "deletion_protection" : false ,
420
+ "random_suffix" : randString (t , 10 ),
421
+ }
422
+
423
+ vcrTest (t , resource.TestCase {
424
+ PreCheck : func () { testAccPreCheck (t ) },
425
+ Providers : testAccProviders ,
426
+ Steps : []resource.TestStep {
427
+ {
428
+ Config : testAccCGCSnippet_sqlMysqlInstanceReplicaExample (context ),
429
+ },
430
+ {
431
+ ResourceName : "google_sql_database_instance.read_replica" ,
432
+ ImportState : true ,
433
+ ImportStateVerify : true ,
434
+ ImportStateVerifyIgnore : []string {"deletion_protection" },
435
+ },
436
+ },
437
+ })
438
+ }
439
+
440
+ func testAccCGCSnippet_sqlMysqlInstanceReplicaExample (context map [string ]interface {}) string {
441
+ return Nprintf (`
442
+ resource "google_sql_database_instance" "primary" {
443
+ name = "tf-test-mysql-primary-instance-name%{random_suffix}"
444
+ region = "europe-west4"
445
+ database_version = "MYSQL_8_0"
446
+ settings {
447
+ tier = "db-n1-standard-2"
448
+ backup_configuration {
449
+ enabled = "true"
450
+ binary_log_enabled = "true"
451
+ }
452
+ }
453
+ deletion_protection = "%{deletion_protection}"
454
+ }
455
+
456
+ resource "google_sql_database_instance" "read_replica" {
457
+ name = "tf-test-mysql-replica-instance-name%{random_suffix}"
458
+ master_instance_name = google_sql_database_instance.primary.name
459
+ region = "europe-west4"
460
+ database_version = "MYSQL_8_0"
461
+
462
+ replica_configuration {
463
+ failover_target = false
464
+ }
465
+
466
+ settings {
467
+ tier = "db-n1-standard-2"
468
+ availability_type = "ZONAL"
469
+ disk_size = "100"
470
+ }
471
+ deletion_protection = "%{deletion_protection}"
472
+ }
473
+ ` , context )
474
+ }
475
+
415
476
func TestAccCGCSnippet_storageNewBucketExample (t * testing.T ) {
416
477
t .Parallel ()
417
478
0 commit comments