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