@@ -258,6 +258,51 @@ func TestAccDataprocCluster_withInternalIpOnlyTrueAndShieldedConfig(t *testing.T
258
258
})
259
259
}
260
260
261
+ func TestAccDataprocCluster_withConfidentialCompute (t * testing.T ) {
262
+ t .Parallel ()
263
+
264
+ var cluster dataproc.Cluster
265
+ rnd := acctest .RandString (t , 10 )
266
+ networkName := acctest .BootstrapSharedTestNetwork (t , "dataproc-cluster" )
267
+ subnetworkName := acctest .BootstrapSubnet (t , "dataproc-cluster" , networkName )
268
+ acctest .BootstrapFirewallForDataprocSharedNetwork (t , "dataproc-cluster" , networkName )
269
+ imageUri := "https://www.googleapis.com/compute/v1/projects/cloud-dataproc/global/images/dataproc-2-1-ubu20-20241026-165100-rc01"
270
+
271
+ acctest .VcrTest (t , resource.TestCase {
272
+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
273
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
274
+ CheckDestroy : testAccCheckDataprocClusterDestroy (t ),
275
+ Steps : []resource.TestStep {
276
+ {
277
+ Config : testAccDataprocCluster_withConfidentialCompute (rnd , subnetworkName , imageUri ),
278
+ Check : resource .ComposeTestCheckFunc (
279
+ testAccCheckDataprocClusterExists (t , "google_dataproc_cluster.confidential" , & cluster ),
280
+
281
+ // Check confidential compute
282
+ resource .TestCheckResourceAttr ("google_dataproc_cluster.confidential" ,
283
+ "cluster_config.0.gce_cluster_config.0.confidential_instance_config.0.enable_confidential_compute" , "true" ),
284
+
285
+ // Check master
286
+ resource .TestCheckResourceAttr ("google_dataproc_cluster.confidential" ,
287
+ "cluster_config.0.master_config.0.machine_type" , "n2d-standard-2" ),
288
+ resource .TestCheckResourceAttr ("google_dataproc_cluster.confidential" ,
289
+ "cluster_config.0.master_config.0.image_uri" , imageUri ),
290
+ resource .TestCheckResourceAttr ("google_dataproc_cluster.confidential" ,
291
+ "cluster_config.0.master_config.0.min_cpu_platform" , "AMD Rome" ),
292
+
293
+ // Check worker
294
+ resource .TestCheckResourceAttr ("google_dataproc_cluster.confidential" ,
295
+ "cluster_config.0.worker_config.0.machine_type" , "n2d-standard-2" ),
296
+ resource .TestCheckResourceAttr ("google_dataproc_cluster.confidential" ,
297
+ "cluster_config.0.worker_config.0.image_uri" , imageUri ),
298
+ resource .TestCheckResourceAttr ("google_dataproc_cluster.confidential" ,
299
+ "cluster_config.0.worker_config.0.min_cpu_platform" , "AMD Rome" ),
300
+ ),
301
+ },
302
+ },
303
+ })
304
+ }
305
+
261
306
func TestAccDataprocCluster_withMetadataAndTags (t * testing.T ) {
262
307
t .Parallel ()
263
308
@@ -1540,6 +1585,36 @@ resource "google_dataproc_cluster" "basic" {
1540
1585
` , rnd , rnd , rnd , rnd )
1541
1586
}
1542
1587
1588
+ func testAccDataprocCluster_withConfidentialCompute (rnd , subnetworkName string , imageUri string ) string {
1589
+ return fmt .Sprintf (`
1590
+ resource "google_dataproc_cluster" "confidential" {
1591
+ name = "tf-test-dproc-%s"
1592
+ region = "us-central1"
1593
+
1594
+ cluster_config {
1595
+ gce_cluster_config {
1596
+ subnetwork = "%s"
1597
+ confidential_instance_config {
1598
+ enable_confidential_compute = true
1599
+ }
1600
+ }
1601
+
1602
+ master_config {
1603
+ machine_type = "n2d-standard-2"
1604
+ image_uri = "%s"
1605
+ min_cpu_platform = "AMD Rome"
1606
+ }
1607
+
1608
+ worker_config {
1609
+ machine_type = "n2d-standard-2"
1610
+ image_uri = "%s"
1611
+ min_cpu_platform = "AMD Rome"
1612
+ }
1613
+ }
1614
+ }
1615
+ ` , rnd , subnetworkName , imageUri , imageUri )
1616
+ }
1617
+
1543
1618
func testAccDataprocCluster_withMetadataAndTags (rnd , subnetworkName string ) string {
1544
1619
return fmt .Sprintf (`
1545
1620
resource "google_dataproc_cluster" "basic" {
0 commit comments