@@ -367,14 +367,15 @@ func TestAccInstanceGroupManager_stateful(t *testing.T) {
367
367
target := fmt .Sprintf ("tf-test-igm-%s" , randString (t , 10 ))
368
368
igm := fmt .Sprintf ("tf-test-igm-%s" , randString (t , 10 ))
369
369
hck := fmt .Sprintf ("tf-test-igm-%s" , randString (t , 10 ))
370
+ network := fmt .Sprintf ("tf-test-igm-%s" , randString (t , 10 ))
370
371
371
372
vcrTest (t , resource.TestCase {
372
373
PreCheck : func () { testAccPreCheck (t ) },
373
374
Providers : testAccProviders ,
374
375
CheckDestroy : testAccCheckInstanceGroupManagerDestroyProducer (t ),
375
376
Steps : []resource.TestStep {
376
377
{
377
- Config : testAccInstanceGroupManager_stateful (template , target , igm , hck ),
378
+ Config : testAccInstanceGroupManager_stateful (network , template , target , igm , hck ),
378
379
},
379
380
{
380
381
ResourceName : "google_compute_instance_group_manager.igm-basic" ,
@@ -383,7 +384,7 @@ func TestAccInstanceGroupManager_stateful(t *testing.T) {
383
384
ImportStateVerifyIgnore : []string {"status" },
384
385
},
385
386
{
386
- Config : testAccInstanceGroupManager_statefulUpdated (template , target , igm , hck ),
387
+ Config : testAccInstanceGroupManager_statefulUpdated (network , template , target , igm , hck ),
387
388
},
388
389
{
389
390
ResourceName : "google_compute_instance_group_manager.igm-basic" ,
@@ -1332,13 +1333,17 @@ resource "google_compute_instance_group_manager" "igm-basic" {
1332
1333
` , primaryTemplate , canaryTemplate , igm )
1333
1334
}
1334
1335
1335
- func testAccInstanceGroupManager_stateful (template , target , igm , hck string ) string {
1336
+ func testAccInstanceGroupManager_stateful (network , template , target , igm , hck string ) string {
1336
1337
return fmt .Sprintf (`
1337
1338
data "google_compute_image" "my_image" {
1338
1339
family = "debian-11"
1339
1340
project = "debian-cloud"
1340
1341
}
1341
1342
1343
+ resource "google_compute_network" "igm-basic" {
1344
+ name = "%s"
1345
+ }
1346
+
1342
1347
resource "google_compute_instance_template" "igm-basic" {
1343
1348
name = "%s"
1344
1349
machine_type = "e2-medium"
@@ -1367,6 +1372,10 @@ resource "google_compute_instance_template" "igm-basic" {
1367
1372
network = "default"
1368
1373
}
1369
1374
1375
+ network_interface {
1376
+ network = google_compute_network.igm-basic.self_link
1377
+ }
1378
+
1370
1379
service_account {
1371
1380
scopes = ["userinfo-email", "compute-ro", "storage-ro"]
1372
1381
}
@@ -1401,16 +1410,20 @@ resource "google_compute_http_health_check" "zero" {
1401
1410
check_interval_sec = 1
1402
1411
timeout_sec = 1
1403
1412
}
1404
- ` , template , target , igm , hck )
1413
+ ` , network , template , target , igm , hck )
1405
1414
}
1406
1415
1407
- func testAccInstanceGroupManager_statefulUpdated (template , target , igm , hck string ) string {
1416
+ func testAccInstanceGroupManager_statefulUpdated (network , template , target , igm , hck string ) string {
1408
1417
return fmt .Sprintf (`
1409
1418
data "google_compute_image" "my_image" {
1410
1419
family = "debian-11"
1411
1420
project = "debian-cloud"
1412
1421
}
1413
1422
1423
+ resource "google_compute_network" "igm-basic" {
1424
+ name = "%s"
1425
+ }
1426
+
1414
1427
resource "google_compute_instance_template" "igm-basic" {
1415
1428
name = "%s"
1416
1429
machine_type = "e2-medium"
@@ -1439,6 +1452,10 @@ resource "google_compute_instance_template" "igm-basic" {
1439
1452
network = "default"
1440
1453
}
1441
1454
1455
+ network_interface {
1456
+ network = google_compute_network.igm-basic.self_link
1457
+ }
1458
+
1442
1459
service_account {
1443
1460
scopes = ["userinfo-email", "compute-ro", "storage-ro"]
1444
1461
}
@@ -1466,10 +1483,6 @@ resource "google_compute_instance_group_manager" "igm-basic" {
1466
1483
delete_rule = "NEVER"
1467
1484
}
1468
1485
1469
- stateful_disk {
1470
- device_name = "my-stateful-disk2"
1471
- delete_rule = "ON_PERMANENT_INSTANCE_DELETION"
1472
- }
1473
1486
}
1474
1487
1475
1488
resource "google_compute_http_health_check" "zero" {
@@ -1478,7 +1491,7 @@ resource "google_compute_http_health_check" "zero" {
1478
1491
check_interval_sec = 1
1479
1492
timeout_sec = 1
1480
1493
}
1481
- ` , template , target , igm , hck )
1494
+ ` , network , template , target , igm , hck )
1482
1495
}
1483
1496
1484
1497
func testAccInstanceGroupManager_waitForStatus (template , target , igm , perInstanceConfig string ) string {
0 commit comments