@@ -2725,6 +2725,30 @@ func TestAccContainerCluster_withWorkloadIdentityConfig(t *testing.T) {
2725
2725
})
2726
2726
}
2727
2727
2728
+ func TestAccContainerCluster_withWorkloadIdentityConfigAutopilot (t * testing.T ) {
2729
+ t .Parallel ()
2730
+
2731
+ clusterName := fmt .Sprintf ("tf-test-cluster-%s" , acctest .RandString (t , 10 ))
2732
+ pid := envvar .GetTestProjectFromEnv ()
2733
+
2734
+ acctest .VcrTest (t , resource.TestCase {
2735
+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
2736
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
2737
+ CheckDestroy : testAccCheckContainerClusterDestroyProducer (t ),
2738
+ Steps : []resource.TestStep {
2739
+ {
2740
+ Config : testAccContainerCluster_withWorkloadIdentityConfigEnabledAutopilot (pid , clusterName ),
2741
+ },
2742
+ {
2743
+ ResourceName : "google_container_cluster.with_workload_identity_config" ,
2744
+ ImportState : true ,
2745
+ ImportStateVerify : true ,
2746
+ ImportStateVerifyIgnore : []string {"remove_default_node_pool" , "deletion_protection" },
2747
+ },
2748
+ },
2749
+ })
2750
+ }
2751
+
2728
2752
func TestAccContainerCluster_withIdentityServiceConfig (t * testing.T ) {
2729
2753
t .Parallel ()
2730
2754
@@ -7328,6 +7352,26 @@ resource "google_container_cluster" "with_workload_identity_config" {
7328
7352
` , projectID , clusterName , networkName , subnetworkName )
7329
7353
}
7330
7354
7355
+ func testAccContainerCluster_withWorkloadIdentityConfigEnabledAutopilot (projectID string , clusterName string ) string {
7356
+ return fmt .Sprintf (`
7357
+ data "google_project" "project" {
7358
+ project_id = "%s"
7359
+ }
7360
+
7361
+ resource "google_container_cluster" "with_workload_identity_config" {
7362
+ name = "%s"
7363
+ location = "us-central1"
7364
+ initial_node_count = 1
7365
+
7366
+ workload_identity_config {
7367
+ workload_pool = "${data.google_project.project.project_id}.svc.id.goog"
7368
+ }
7369
+ enable_autopilot = true
7370
+ deletion_protection = false
7371
+ }
7372
+ ` , projectID , clusterName )
7373
+ }
7374
+
7331
7375
func testAccContainerCluster_updateWorkloadIdentityConfig (projectID , clusterName , networkName , subnetworkName string , enable bool ) string {
7332
7376
workloadIdentityConfig := ""
7333
7377
if enable {
0 commit comments