github.com/jrperritt/terraform@v0.1.1-0.20170525065507-96f391dafc38/builtin/providers/google/resource_sql_database_instance_test.go (about) 1 package google 2 3 /** 4 * Note! You must run these tests once at a time. Google Cloud SQL does 5 * not allow you to reuse a database for a short time after you reserved it, 6 * and for this reason the tests will fail if the same config is used serveral 7 * times in short succession. 8 */ 9 10 import ( 11 "fmt" 12 "strconv" 13 "strings" 14 "testing" 15 16 "github.com/hashicorp/terraform/helper/acctest" 17 "github.com/hashicorp/terraform/helper/resource" 18 "github.com/hashicorp/terraform/terraform" 19 20 "google.golang.org/api/sqladmin/v1beta4" 21 ) 22 23 func TestAccGoogleSqlDatabaseInstance_basic(t *testing.T) { 24 var instance sqladmin.DatabaseInstance 25 databaseID := acctest.RandInt() 26 27 resource.Test(t, resource.TestCase{ 28 PreCheck: func() { testAccPreCheck(t) }, 29 Providers: testAccProviders, 30 CheckDestroy: testAccGoogleSqlDatabaseInstanceDestroy, 31 Steps: []resource.TestStep{ 32 resource.TestStep{ 33 Config: fmt.Sprintf( 34 testGoogleSqlDatabaseInstance_basic, databaseID), 35 Check: resource.ComposeTestCheckFunc( 36 testAccCheckGoogleSqlDatabaseInstanceExists( 37 "google_sql_database_instance.instance", &instance), 38 testAccCheckGoogleSqlDatabaseInstanceEquals( 39 "google_sql_database_instance.instance", &instance), 40 ), 41 }, 42 }, 43 }) 44 } 45 46 func TestAccGoogleSqlDatabaseInstance_basic2(t *testing.T) { 47 var instance sqladmin.DatabaseInstance 48 49 resource.Test(t, resource.TestCase{ 50 PreCheck: func() { testAccPreCheck(t) }, 51 Providers: testAccProviders, 52 CheckDestroy: testAccGoogleSqlDatabaseInstanceDestroy, 53 Steps: []resource.TestStep{ 54 resource.TestStep{ 55 Config: testGoogleSqlDatabaseInstance_basic2, 56 Check: resource.ComposeTestCheckFunc( 57 testAccCheckGoogleSqlDatabaseInstanceExists( 58 "google_sql_database_instance.instance", &instance), 59 testAccCheckGoogleSqlDatabaseInstanceEquals( 60 "google_sql_database_instance.instance", &instance), 61 ), 62 }, 63 }, 64 }) 65 } 66 67 func TestAccGoogleSqlDatabaseInstance_basic3(t *testing.T) { 68 var instance sqladmin.DatabaseInstance 69 databaseID := acctest.RandInt() 70 71 resource.Test(t, resource.TestCase{ 72 PreCheck: func() { testAccPreCheck(t) }, 73 Providers: testAccProviders, 74 CheckDestroy: testAccGoogleSqlDatabaseInstanceDestroy, 75 Steps: []resource.TestStep{ 76 resource.TestStep{ 77 Config: fmt.Sprintf( 78 testGoogleSqlDatabaseInstance_basic3, databaseID), 79 Check: resource.ComposeTestCheckFunc( 80 testAccCheckGoogleSqlDatabaseInstanceExists( 81 "google_sql_database_instance.instance", &instance), 82 testAccCheckGoogleSqlDatabaseInstanceEquals( 83 "google_sql_database_instance.instance", &instance), 84 testAccCheckGoogleSqlDatabaseRootUserDoesNotExist( 85 &instance), 86 ), 87 }, 88 }, 89 }) 90 } 91 func TestAccGoogleSqlDatabaseInstance_settings_basic(t *testing.T) { 92 var instance sqladmin.DatabaseInstance 93 databaseID := acctest.RandInt() 94 95 resource.Test(t, resource.TestCase{ 96 PreCheck: func() { testAccPreCheck(t) }, 97 Providers: testAccProviders, 98 CheckDestroy: testAccGoogleSqlDatabaseInstanceDestroy, 99 Steps: []resource.TestStep{ 100 resource.TestStep{ 101 Config: fmt.Sprintf( 102 testGoogleSqlDatabaseInstance_settings, databaseID), 103 Check: resource.ComposeTestCheckFunc( 104 testAccCheckGoogleSqlDatabaseInstanceExists( 105 "google_sql_database_instance.instance", &instance), 106 testAccCheckGoogleSqlDatabaseInstanceEquals( 107 "google_sql_database_instance.instance", &instance), 108 ), 109 }, 110 }, 111 }) 112 } 113 114 func TestAccGoogleSqlDatabaseInstance_slave(t *testing.T) { 115 var instance sqladmin.DatabaseInstance 116 masterID := acctest.RandInt() 117 slaveID := acctest.RandInt() 118 119 resource.Test(t, resource.TestCase{ 120 PreCheck: func() { testAccPreCheck(t) }, 121 Providers: testAccProviders, 122 CheckDestroy: testAccGoogleSqlDatabaseInstanceDestroy, 123 Steps: []resource.TestStep{ 124 resource.TestStep{ 125 Config: fmt.Sprintf( 126 testGoogleSqlDatabaseInstance_slave, masterID, slaveID), 127 Check: resource.ComposeTestCheckFunc( 128 testAccCheckGoogleSqlDatabaseInstanceExists( 129 "google_sql_database_instance.instance_master", &instance), 130 testAccCheckGoogleSqlDatabaseInstanceEquals( 131 "google_sql_database_instance.instance_master", &instance), 132 testAccCheckGoogleSqlDatabaseInstanceExists( 133 "google_sql_database_instance.instance_slave", &instance), 134 testAccCheckGoogleSqlDatabaseInstanceEquals( 135 "google_sql_database_instance.instance_slave", &instance), 136 ), 137 }, 138 }, 139 }) 140 } 141 142 func TestAccGoogleSqlDatabaseInstance_diskspecs(t *testing.T) { 143 var instance sqladmin.DatabaseInstance 144 masterID := acctest.RandInt() 145 146 resource.Test(t, resource.TestCase{ 147 PreCheck: func() { testAccPreCheck(t) }, 148 Providers: testAccProviders, 149 CheckDestroy: testAccGoogleSqlDatabaseInstanceDestroy, 150 Steps: []resource.TestStep{ 151 resource.TestStep{ 152 Config: fmt.Sprintf( 153 testGoogleSqlDatabaseInstance_diskspecs, masterID), 154 Check: resource.ComposeTestCheckFunc( 155 testAccCheckGoogleSqlDatabaseInstanceExists( 156 "google_sql_database_instance.instance", &instance), 157 testAccCheckGoogleSqlDatabaseInstanceEquals( 158 "google_sql_database_instance.instance", &instance), 159 ), 160 }, 161 }, 162 }) 163 } 164 165 func TestAccGoogleSqlDatabaseInstance_maintenance(t *testing.T) { 166 var instance sqladmin.DatabaseInstance 167 masterID := acctest.RandInt() 168 169 resource.Test(t, resource.TestCase{ 170 PreCheck: func() { testAccPreCheck(t) }, 171 Providers: testAccProviders, 172 CheckDestroy: testAccGoogleSqlDatabaseInstanceDestroy, 173 Steps: []resource.TestStep{ 174 resource.TestStep{ 175 Config: fmt.Sprintf( 176 testGoogleSqlDatabaseInstance_maintenance, masterID), 177 Check: resource.ComposeTestCheckFunc( 178 testAccCheckGoogleSqlDatabaseInstanceExists( 179 "google_sql_database_instance.instance", &instance), 180 testAccCheckGoogleSqlDatabaseInstanceEquals( 181 "google_sql_database_instance.instance", &instance), 182 ), 183 }, 184 }, 185 }) 186 } 187 188 func TestAccGoogleSqlDatabaseInstance_settings_upgrade(t *testing.T) { 189 var instance sqladmin.DatabaseInstance 190 databaseID := acctest.RandInt() 191 192 resource.Test(t, resource.TestCase{ 193 PreCheck: func() { testAccPreCheck(t) }, 194 Providers: testAccProviders, 195 CheckDestroy: testAccGoogleSqlDatabaseInstanceDestroy, 196 Steps: []resource.TestStep{ 197 resource.TestStep{ 198 Config: fmt.Sprintf( 199 testGoogleSqlDatabaseInstance_basic, databaseID), 200 Check: resource.ComposeTestCheckFunc( 201 testAccCheckGoogleSqlDatabaseInstanceExists( 202 "google_sql_database_instance.instance", &instance), 203 testAccCheckGoogleSqlDatabaseInstanceEquals( 204 "google_sql_database_instance.instance", &instance), 205 ), 206 }, 207 resource.TestStep{ 208 Config: fmt.Sprintf( 209 testGoogleSqlDatabaseInstance_settings, databaseID), 210 Check: resource.ComposeTestCheckFunc( 211 testAccCheckGoogleSqlDatabaseInstanceExists( 212 "google_sql_database_instance.instance", &instance), 213 testAccCheckGoogleSqlDatabaseInstanceEquals( 214 "google_sql_database_instance.instance", &instance), 215 ), 216 }, 217 }, 218 }) 219 } 220 221 func TestAccGoogleSqlDatabaseInstance_settings_downgrade(t *testing.T) { 222 var instance sqladmin.DatabaseInstance 223 databaseID := acctest.RandInt() 224 225 resource.Test(t, resource.TestCase{ 226 PreCheck: func() { testAccPreCheck(t) }, 227 Providers: testAccProviders, 228 CheckDestroy: testAccGoogleSqlDatabaseInstanceDestroy, 229 Steps: []resource.TestStep{ 230 resource.TestStep{ 231 Config: fmt.Sprintf( 232 testGoogleSqlDatabaseInstance_settings, databaseID), 233 Check: resource.ComposeTestCheckFunc( 234 testAccCheckGoogleSqlDatabaseInstanceExists( 235 "google_sql_database_instance.instance", &instance), 236 testAccCheckGoogleSqlDatabaseInstanceEquals( 237 "google_sql_database_instance.instance", &instance), 238 ), 239 }, 240 resource.TestStep{ 241 Config: fmt.Sprintf( 242 testGoogleSqlDatabaseInstance_basic, databaseID), 243 Check: resource.ComposeTestCheckFunc( 244 testAccCheckGoogleSqlDatabaseInstanceExists( 245 "google_sql_database_instance.instance", &instance), 246 testAccCheckGoogleSqlDatabaseInstanceEquals( 247 "google_sql_database_instance.instance", &instance), 248 ), 249 }, 250 }, 251 }) 252 } 253 254 // GH-4222 255 func TestAccGoogleSqlDatabaseInstance_authNets(t *testing.T) { 256 // var instance sqladmin.DatabaseInstance 257 databaseID := acctest.RandInt() 258 259 resource.Test(t, resource.TestCase{ 260 PreCheck: func() { testAccPreCheck(t) }, 261 Providers: testAccProviders, 262 CheckDestroy: testAccGoogleSqlDatabaseInstanceDestroy, 263 Steps: []resource.TestStep{ 264 resource.TestStep{ 265 Config: fmt.Sprintf( 266 testGoogleSqlDatabaseInstance_authNets_step1, databaseID), 267 }, 268 resource.TestStep{ 269 Config: fmt.Sprintf( 270 testGoogleSqlDatabaseInstance_authNets_step2, databaseID), 271 }, 272 resource.TestStep{ 273 Config: fmt.Sprintf( 274 testGoogleSqlDatabaseInstance_authNets_step1, databaseID), 275 }, 276 }, 277 }) 278 } 279 280 func testAccCheckGoogleSqlDatabaseInstanceEquals(n string, 281 instance *sqladmin.DatabaseInstance) resource.TestCheckFunc { 282 return func(s *terraform.State) error { 283 rs, ok := s.RootModule().Resources[n] 284 if !ok { 285 return fmt.Errorf("Not found: %s", n) 286 } 287 attributes := rs.Primary.Attributes 288 289 server := instance.Name 290 local := attributes["name"] 291 if server != local { 292 return fmt.Errorf("Error name mismatch, (%s, %s)", server, local) 293 } 294 295 server = instance.Settings.Tier 296 local = attributes["settings.0.tier"] 297 if server != local { 298 return fmt.Errorf("Error settings.tier mismatch, (%s, %s)", server, local) 299 } 300 301 server = strings.TrimPrefix(instance.MasterInstanceName, instance.Project+":") 302 local = attributes["master_instance_name"] 303 if server != local && len(server) > 0 && len(local) > 0 { 304 return fmt.Errorf("Error master_instance_name mismatch, (%s, %s)", server, local) 305 } 306 307 server = instance.Settings.ActivationPolicy 308 local = attributes["settings.0.activation_policy"] 309 if server != local && len(server) > 0 && len(local) > 0 { 310 return fmt.Errorf("Error settings.activation_policy mismatch, (%s, %s)", server, local) 311 } 312 313 if instance.Settings.BackupConfiguration != nil { 314 server = strconv.FormatBool(instance.Settings.BackupConfiguration.BinaryLogEnabled) 315 local = attributes["settings.0.backup_configuration.0.binary_log_enabled"] 316 if server != local && len(server) > 0 && len(local) > 0 { 317 return fmt.Errorf("Error settings.backup_configuration.binary_log_enabled mismatch, (%s, %s)", server, local) 318 } 319 320 server = strconv.FormatBool(instance.Settings.BackupConfiguration.Enabled) 321 local = attributes["settings.0.backup_configuration.0.enabled"] 322 if server != local && len(server) > 0 && len(local) > 0 { 323 return fmt.Errorf("Error settings.backup_configuration.enabled mismatch, (%s, %s)", server, local) 324 } 325 326 server = instance.Settings.BackupConfiguration.StartTime 327 local = attributes["settings.0.backup_configuration.0.start_time"] 328 if server != local && len(server) > 0 && len(local) > 0 { 329 return fmt.Errorf("Error settings.backup_configuration.start_time mismatch, (%s, %s)", server, local) 330 } 331 } 332 333 server = strconv.FormatBool(instance.Settings.CrashSafeReplicationEnabled) 334 local = attributes["settings.0.crash_safe_replication"] 335 if server != local && len(server) > 0 && len(local) > 0 { 336 return fmt.Errorf("Error settings.crash_safe_replication mismatch, (%s, %s)", server, local) 337 } 338 339 server = strconv.FormatBool(instance.Settings.StorageAutoResize) 340 local = attributes["settings.0.disk_autoresize"] 341 if server != local && len(server) > 0 && len(local) > 0 { 342 return fmt.Errorf("Error settings.disk_autoresize mismatch, (%s, %s)", server, local) 343 } 344 345 server = strconv.FormatInt(instance.Settings.DataDiskSizeGb, 10) 346 local = attributes["settings.0.disk_size"] 347 if server != local && len(server) > 0 && len(local) > 0 && local != "0" { 348 return fmt.Errorf("Error settings.disk_size mismatch, (%s, %s)", server, local) 349 } 350 351 server = instance.Settings.DataDiskType 352 local = attributes["settings.0.disk_type"] 353 if server != local && len(server) > 0 && len(local) > 0 { 354 return fmt.Errorf("Error settings.disk_type mismatch, (%s, %s)", server, local) 355 } 356 357 if instance.Settings.IpConfiguration != nil { 358 server = strconv.FormatBool(instance.Settings.IpConfiguration.Ipv4Enabled) 359 local = attributes["settings.0.ip_configuration.0.ipv4_enabled"] 360 if server != local && len(server) > 0 && len(local) > 0 { 361 return fmt.Errorf("Error settings.ip_configuration.ipv4_enabled mismatch, (%s, %s)", server, local) 362 } 363 364 server = strconv.FormatBool(instance.Settings.IpConfiguration.RequireSsl) 365 local = attributes["settings.0.ip_configuration.0.require_ssl"] 366 if server != local && len(server) > 0 && len(local) > 0 { 367 return fmt.Errorf("Error settings.ip_configuration.require_ssl mismatch, (%s, %s)", server, local) 368 } 369 } 370 371 if instance.Settings.LocationPreference != nil { 372 server = instance.Settings.LocationPreference.FollowGaeApplication 373 local = attributes["settings.0.location_preference.0.follow_gae_application"] 374 if server != local && len(server) > 0 && len(local) > 0 { 375 return fmt.Errorf("Error settings.location_preference.follow_gae_application mismatch, (%s, %s)", server, local) 376 } 377 378 server = instance.Settings.LocationPreference.Zone 379 local = attributes["settings.0.location_preference.0.zone"] 380 if server != local && len(server) > 0 && len(local) > 0 { 381 return fmt.Errorf("Error settings.location_preference.zone mismatch, (%s, %s)", server, local) 382 } 383 } 384 385 if instance.Settings.MaintenanceWindow != nil { 386 server = strconv.FormatInt(instance.Settings.MaintenanceWindow.Day, 10) 387 local = attributes["settings.0.maintenance_window.0.day"] 388 if server != local && len(server) > 0 && len(local) > 0 { 389 return fmt.Errorf("Error settings.maintenance_window.day mismatch, (%s, %s)", server, local) 390 } 391 392 server = strconv.FormatInt(instance.Settings.MaintenanceWindow.Hour, 10) 393 local = attributes["settings.0.maintenance_window.0.hour"] 394 if server != local && len(server) > 0 && len(local) > 0 { 395 return fmt.Errorf("Error settings.maintenance_window.hour mismatch, (%s, %s)", server, local) 396 } 397 398 server = instance.Settings.MaintenanceWindow.UpdateTrack 399 local = attributes["settings.0.maintenance_window.0.update_track"] 400 if server != local && len(server) > 0 && len(local) > 0 { 401 return fmt.Errorf("Error settings.maintenance_window.update_track mismatch, (%s, %s)", server, local) 402 } 403 } 404 405 server = instance.Settings.PricingPlan 406 local = attributes["settings.0.pricing_plan"] 407 if server != local && len(server) > 0 && len(local) > 0 { 408 return fmt.Errorf("Error settings.pricing_plan mismatch, (%s, %s)", server, local) 409 } 410 411 if instance.ReplicaConfiguration != nil { 412 server = strconv.FormatBool(instance.ReplicaConfiguration.FailoverTarget) 413 local = attributes["replica_configuration.0.failover_target"] 414 if server != local && len(server) > 0 && len(local) > 0 { 415 return fmt.Errorf("Error replica_configuration.failover_target mismatch, (%s, %s)", server, local) 416 } 417 } 418 419 return nil 420 } 421 } 422 423 func testAccCheckGoogleSqlDatabaseInstanceExists(n string, 424 instance *sqladmin.DatabaseInstance) resource.TestCheckFunc { 425 return func(s *terraform.State) error { 426 config := testAccProvider.Meta().(*Config) 427 rs, ok := s.RootModule().Resources[n] 428 if !ok { 429 return fmt.Errorf("Not found: %s", n) 430 } 431 432 found, err := config.clientSqlAdmin.Instances.Get(config.Project, 433 rs.Primary.Attributes["name"]).Do() 434 435 *instance = *found 436 437 if err != nil { 438 return fmt.Errorf("Not found: %s", n) 439 } 440 441 return nil 442 } 443 } 444 445 func testAccGoogleSqlDatabaseInstanceDestroy(s *terraform.State) error { 446 for _, rs := range s.RootModule().Resources { 447 config := testAccProvider.Meta().(*Config) 448 if rs.Type != "google_sql_database_instance" { 449 continue 450 } 451 452 _, err := config.clientSqlAdmin.Instances.Get(config.Project, 453 rs.Primary.Attributes["name"]).Do() 454 if err == nil { 455 return fmt.Errorf("Database Instance still exists") 456 } 457 } 458 459 return nil 460 } 461 462 func testAccCheckGoogleSqlDatabaseRootUserDoesNotExist( 463 instance *sqladmin.DatabaseInstance) resource.TestCheckFunc { 464 return func(s *terraform.State) error { 465 config := testAccProvider.Meta().(*Config) 466 467 users, err := config.clientSqlAdmin.Users.List(config.Project, instance.Name).Do() 468 469 if err != nil { 470 return fmt.Errorf("Could not list database users for %q: %s", instance.Name, err) 471 } 472 473 for _, u := range users.Items { 474 if u.Name == "root" && u.Host == "%" { 475 return fmt.Errorf("%v@%v user still exists", u.Name, u.Host) 476 } 477 } 478 479 return nil 480 } 481 } 482 483 var testGoogleSqlDatabaseInstance_basic = ` 484 resource "google_sql_database_instance" "instance" { 485 name = "tf-lw-%d" 486 region = "us-central" 487 settings { 488 tier = "D0" 489 crash_safe_replication = false 490 } 491 } 492 ` 493 494 var testGoogleSqlDatabaseInstance_basic2 = ` 495 resource "google_sql_database_instance" "instance" { 496 region = "us-central" 497 settings { 498 tier = "D0" 499 crash_safe_replication = false 500 } 501 } 502 ` 503 var testGoogleSqlDatabaseInstance_basic3 = ` 504 resource "google_sql_database_instance" "instance" { 505 name = "tf-lw-%d" 506 region = "us-central" 507 settings { 508 tier = "db-f1-micro" 509 } 510 } 511 ` 512 513 var testGoogleSqlDatabaseInstance_settings = ` 514 resource "google_sql_database_instance" "instance" { 515 name = "tf-lw-%d" 516 region = "us-central" 517 settings { 518 tier = "D0" 519 crash_safe_replication = false 520 replication_type = "ASYNCHRONOUS" 521 location_preference { 522 zone = "us-central1-f" 523 } 524 525 ip_configuration { 526 ipv4_enabled = "true" 527 authorized_networks { 528 value = "108.12.12.12" 529 name = "misc" 530 expiration_time = "2017-11-15T16:19:00.094Z" 531 } 532 } 533 534 backup_configuration { 535 enabled = "true" 536 start_time = "19:19" 537 } 538 539 activation_policy = "ON_DEMAND" 540 } 541 } 542 ` 543 544 // Note - this test is not feasible to run unless we generate 545 // backups first. 546 var testGoogleSqlDatabaseInstance_replica = ` 547 resource "google_sql_database_instance" "instance_master" { 548 name = "tf-lw-%d" 549 database_version = "MYSQL_5_6" 550 region = "us-east1" 551 552 settings { 553 tier = "D0" 554 crash_safe_replication = true 555 556 backup_configuration { 557 enabled = true 558 start_time = "00:00" 559 binary_log_enabled = true 560 } 561 } 562 } 563 564 resource "google_sql_database_instance" "instance" { 565 name = "tf-lw-%d" 566 database_version = "MYSQL_5_6" 567 region = "us-central" 568 569 settings { 570 tier = "D0" 571 } 572 573 master_instance_name = "${google_sql_database_instance.instance_master.name}" 574 575 replica_configuration { 576 ca_certificate = "${file("~/tmp/fake.pem")}" 577 client_certificate = "${file("~/tmp/fake.pem")}" 578 client_key = "${file("~/tmp/fake.pem")}" 579 connect_retry_interval = 100 580 master_heartbeat_period = 10000 581 password = "password" 582 username = "username" 583 ssl_cipher = "ALL" 584 verify_server_certificate = false 585 } 586 } 587 ` 588 589 var testGoogleSqlDatabaseInstance_slave = ` 590 resource "google_sql_database_instance" "instance_master" { 591 name = "tf-lw-%d" 592 region = "us-central1" 593 594 settings { 595 tier = "db-f1-micro" 596 597 backup_configuration { 598 enabled = true 599 binary_log_enabled = true 600 } 601 } 602 } 603 604 resource "google_sql_database_instance" "instance_slave" { 605 name = "tf-lw-%d" 606 region = "us-central1" 607 608 master_instance_name = "${google_sql_database_instance.instance_master.name}" 609 610 settings { 611 tier = "db-f1-micro" 612 } 613 } 614 ` 615 616 var testGoogleSqlDatabaseInstance_diskspecs = ` 617 resource "google_sql_database_instance" "instance" { 618 name = "tf-lw-%d" 619 region = "us-central1" 620 621 settings { 622 tier = "db-f1-micro" 623 disk_autoresize = true 624 disk_size = 15 625 disk_type = "PD_HDD" 626 } 627 } 628 ` 629 630 var testGoogleSqlDatabaseInstance_maintenance = ` 631 resource "google_sql_database_instance" "instance" { 632 name = "tf-lw-%d" 633 region = "us-central1" 634 635 settings { 636 tier = "db-f1-micro" 637 638 maintenance_window { 639 day = 7 640 hour = 3 641 update_track = "canary" 642 } 643 } 644 } 645 ` 646 647 var testGoogleSqlDatabaseInstance_authNets_step1 = ` 648 resource "google_sql_database_instance" "instance" { 649 name = "tf-lw-%d" 650 region = "us-central" 651 settings { 652 tier = "D0" 653 crash_safe_replication = false 654 655 ip_configuration { 656 ipv4_enabled = "true" 657 authorized_networks { 658 value = "108.12.12.12" 659 name = "misc" 660 expiration_time = "2017-11-15T16:19:00.094Z" 661 } 662 } 663 } 664 } 665 ` 666 667 var testGoogleSqlDatabaseInstance_authNets_step2 = ` 668 resource "google_sql_database_instance" "instance" { 669 name = "tf-lw-%d" 670 region = "us-central" 671 settings { 672 tier = "D0" 673 crash_safe_replication = false 674 675 ip_configuration { 676 ipv4_enabled = "true" 677 } 678 } 679 } 680 `