@@ -588,7 +588,7 @@ func TestAccGkeHubFeatureMembership_gkehubFeatureMesh(t *testing.T) {
588588 CheckDestroy : testAccCheckGKEHubFeatureDestroyProducer (t ),
589589 Steps : []resource.TestStep {
590590 {
591- Config : testAccGkeHubFeatureMembership_gkehubFeatureMeshStart (context ),
591+ Config : testAccGkeHubFeatureMembership_meshStart (context ),
592592 Check : resource .ComposeTestCheckFunc (
593593 testAccCheckGkeHubFeatureMembershipPresent (t , fmt .Sprintf ("tf-test-gkehub%s" , context ["random_suffix" ]), "global" , "servicemesh" , fmt .Sprintf ("tf-test1%s" , context ["random_suffix" ])),
594594 ),
@@ -599,7 +599,18 @@ func TestAccGkeHubFeatureMembership_gkehubFeatureMesh(t *testing.T) {
599599 ImportStateVerify : true ,
600600 },
601601 {
602- Config : testAccGkeHubFeatureMembership_gkehubFeatureMeshUpdate (context ),
602+ Config : testAccGkeHubFeatureMembership_meshUpdateManagement (context ),
603+ Check : resource .ComposeTestCheckFunc (
604+ testAccCheckGkeHubFeatureMembershipPresent (t , fmt .Sprintf ("tf-test-gkehub%s" , context ["random_suffix" ]), "global" , "servicemesh" , fmt .Sprintf ("tf-test1%s" , context ["random_suffix" ])),
605+ ),
606+ },
607+ {
608+ ResourceName : "google_gke_hub_feature_membership.feature_member" ,
609+ ImportState : true ,
610+ ImportStateVerify : true ,
611+ },
612+ {
613+ Config : testAccGkeHubFeatureMembership_meshUpdateControlPlane (context ),
603614 Check : resource .ComposeTestCheckFunc (
604615 testAccCheckGkeHubFeatureMembershipPresent (t , fmt .Sprintf ("tf-test-gkehub%s" , context ["random_suffix" ]), "global" , "servicemesh" , fmt .Sprintf ("tf-test1%s" , context ["random_suffix" ])),
605616 ),
@@ -613,15 +624,15 @@ func TestAccGkeHubFeatureMembership_gkehubFeatureMesh(t *testing.T) {
613624 })
614625}
615626
616- func testAccGkeHubFeatureMembership_gkehubFeatureMeshStart (context map [string ]interface {}) string {
627+ func testAccGkeHubFeatureMembership_meshStart (context map [string ]interface {}) string {
617628 return gkeHubFeatureProjectSetup (context ) + Nprintf (`
618629resource "google_container_cluster" "primary" {
619630 project = google_project.project.project_id
620631 name = "tf-test-cl%{random_suffix}"
621632 location = "us-central1-a"
622633 initial_node_count = 1
623634 provider = google-beta
624- depends_on = [google_project_service.mci, google_project_service. container, google_project_service.container, google_project_service. gkehub, google_project_service.mesh ]
635+ depends_on = [google_project_service.container, google_project_service.gkehub]
625636}
626637
627638resource "google_gke_hub_membership" "membership" {
@@ -645,7 +656,7 @@ resource "google_gke_hub_feature" "feature" {
645656 foo = "bar"
646657 }
647658 provider = google-beta
648- depends_on = [google_project_service.mci, google_project_service. container, google_project_service.container , google_project_service.gkehub ]
659+ depends_on = [google_project_service.container, google_project_service.gkehub , google_project_service.mesh ]
649660}
650661
651662resource "google_service_account" "feature_sa" {
@@ -661,21 +672,22 @@ resource "google_gke_hub_feature_membership" "feature_member" {
661672 membership = google_gke_hub_membership.membership.membership_id
662673 mesh {
663674 management = "MANAGEMENT_AUTOMATIC"
675+ control_plane = "AUTOMATIC"
664676 }
665677 provider = google-beta
666678}
667679` , context )
668680}
669681
670- func testAccGkeHubFeatureMembership_gkehubFeatureMeshUpdate (context map [string ]interface {}) string {
682+ func testAccGkeHubFeatureMembership_meshUpdateManagement (context map [string ]interface {}) string {
671683 return gkeHubFeatureProjectSetup (context ) + Nprintf (`
672684resource "google_container_cluster" "primary" {
673685 project = google_project.project.project_id
674686 name = "tf-test-cl%{random_suffix}"
675687 location = "us-central1-a"
676688 initial_node_count = 1
677689 provider = google-beta
678- depends_on = [google_project_service.mci, google_project_service. container, google_project_service.container ]
690+ depends_on = [google_project_service.container, google_project_service.gkehub ]
679691}
680692
681693resource "google_gke_hub_membership" "membership" {
@@ -699,7 +711,7 @@ resource "google_gke_hub_feature" "feature" {
699711 foo = "bar"
700712 }
701713 provider = google-beta
702- depends_on = [google_project_service.mci, google_project_service. container, google_project_service.container , google_project_service.gkehub ]
714+ depends_on = [google_project_service.container, google_project_service.gkehub , google_project_service.mesh ]
703715}
704716
705717resource "google_service_account" "feature_sa" {
@@ -721,6 +733,60 @@ resource "google_gke_hub_feature_membership" "feature_member" {
721733` , context )
722734}
723735
736+ func testAccGkeHubFeatureMembership_meshUpdateControlPlane (context map [string ]interface {}) string {
737+ return gkeHubFeatureProjectSetup (context ) + Nprintf (`
738+ resource "google_container_cluster" "primary" {
739+ project = google_project.project.project_id
740+ name = "tf-test-cl%{random_suffix}"
741+ location = "us-central1-a"
742+ initial_node_count = 1
743+ provider = google-beta
744+ depends_on = [google_project_service.container, google_project_service.gkehub]
745+ }
746+
747+ resource "google_gke_hub_membership" "membership" {
748+ project = google_project.project.project_id
749+ membership_id = "tf-test1%{random_suffix}"
750+ endpoint {
751+ gke_cluster {
752+ resource_link = "//container.googleapis.com/${google_container_cluster.primary.id}"
753+ }
754+ }
755+ description = "test resource."
756+ provider = google-beta
757+ }
758+
759+ resource "google_gke_hub_feature" "feature" {
760+ project = google_project.project.project_id
761+ name = "servicemesh"
762+ location = "global"
763+
764+ labels = {
765+ foo = "bar"
766+ }
767+ provider = google-beta
768+ depends_on = [google_project_service.container, google_project_service.gkehub, google_project_service.mesh]
769+ }
770+
771+ resource "google_service_account" "feature_sa" {
772+ project = google_project.project.project_id
773+ account_id = "feature-sa"
774+ provider = google-beta
775+ }
776+
777+ resource "google_gke_hub_feature_membership" "feature_member" {
778+ project = google_project.project.project_id
779+ location = "global"
780+ feature = google_gke_hub_feature.feature.name
781+ membership = google_gke_hub_membership.membership.membership_id
782+ mesh {
783+ control_plane = "MANUAL"
784+ }
785+ provider = google-beta
786+ }
787+ ` , context )
788+ }
789+
724790func gkeHubClusterMembershipSetup (context map [string ]interface {}) string {
725791 return Nprintf (`
726792resource "google_container_cluster" "primary" {
0 commit comments