@@ -450,6 +450,27 @@ func TestAccDataprocCluster_nonPreemptibleSecondary(t *testing.T) {
450
450
})
451
451
}
452
452
453
+ func TestAccDataprocCluster_spotSecondary (t * testing.T ) {
454
+ t .Parallel ()
455
+
456
+ rnd := randString (t , 10 )
457
+ var cluster dataproc.Cluster
458
+ vcrTest (t , resource.TestCase {
459
+ PreCheck : func () { testAccPreCheck (t ) },
460
+ Providers : testAccProviders ,
461
+ CheckDestroy : testAccCheckDataprocClusterDestroy (t ),
462
+ Steps : []resource.TestStep {
463
+ {
464
+ Config : testAccDataprocCluster_spotSecondary (rnd ),
465
+ Check : resource .ComposeTestCheckFunc (
466
+ testAccCheckDataprocClusterExists (t , "google_dataproc_cluster.spot_secondary" , & cluster ),
467
+ resource .TestCheckResourceAttr ("google_dataproc_cluster.spot_secondary" , "cluster_config.0.preemptible_worker_config.0.preemptibility" , "SPOT" ),
468
+ ),
469
+ },
470
+ },
471
+ })
472
+ }
473
+
453
474
func TestAccDataprocCluster_withStagingBucket (t * testing.T ) {
454
475
t .Parallel ()
455
476
@@ -1498,6 +1519,41 @@ resource "google_dataproc_cluster" "non_preemptible_secondary" {
1498
1519
` , rnd )
1499
1520
}
1500
1521
1522
+ func testAccDataprocCluster_spotSecondary (rnd string ) string {
1523
+ return fmt .Sprintf (`
1524
+ resource "google_dataproc_cluster" "spot_secondary" {
1525
+ name = "tf-test-dproc-%s"
1526
+ region = "us-central1"
1527
+
1528
+ cluster_config {
1529
+ master_config {
1530
+ num_instances = "1"
1531
+ machine_type = "e2-medium"
1532
+ disk_config {
1533
+ boot_disk_size_gb = 35
1534
+ }
1535
+ }
1536
+
1537
+ worker_config {
1538
+ num_instances = "2"
1539
+ machine_type = "e2-medium"
1540
+ disk_config {
1541
+ boot_disk_size_gb = 35
1542
+ }
1543
+ }
1544
+
1545
+ preemptible_worker_config {
1546
+ num_instances = "1"
1547
+ preemptibility = "SPOT"
1548
+ disk_config {
1549
+ boot_disk_size_gb = 35
1550
+ }
1551
+ }
1552
+ }
1553
+ }
1554
+ ` , rnd )
1555
+ }
1556
+
1501
1557
func testAccDataprocCluster_withStagingBucketOnly (bucketName string ) string {
1502
1558
return fmt .Sprintf (`
1503
1559
resource "google_storage_bucket" "bucket" {
0 commit comments