From 05927dc7683e3147b1c724bad62ef08e2a911838 Mon Sep 17 00:00:00 2001 From: haiyanmeng Date: Fri, 13 Sep 2024 10:10:26 -0700 Subject: [PATCH] Add an example for Config Sync auto-upgrades into google_gkehub_feature_membership resource doc (#11684) --- .../gke_hub_feature_membership.html.markdown | 105 +++++++++++++----- 1 file changed, 77 insertions(+), 28 deletions(-) diff --git a/mmv1/third_party/terraform/website/docs/r/gke_hub_feature_membership.html.markdown b/mmv1/third_party/terraform/website/docs/r/gke_hub_feature_membership.html.markdown index 921655e53e0a..253bcf920512 100644 --- a/mmv1/third_party/terraform/website/docs/r/gke_hub_feature_membership.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/gke_hub_feature_membership.html.markdown @@ -8,7 +8,10 @@ description: |- Contains information about a GKEHub Feature Memberships. Feature Memberships configure GKEHub Features that apply to specific memberships rather than the project as a whole. The google_gke_hub is the Fleet API. -## Example Usage - Config Management +## Example Usage - Config Management with Config Sync auto-upgrades and without Git/OCI + +With [Config Sync auto-upgrades](https://cloud.devsite.corp.google.com/kubernetes-engine/enterprise/config-sync/docs/how-to/upgrade-config-sync#auto-upgrade-config), Google assumes responsibility for automatically upgrading Config Sync versions +and overseeing the lifecycle of its components. ```hcl resource "google_container_cluster" "cluster" { @@ -40,17 +43,20 @@ resource "google_gke_hub_feature_membership" "feature_member" { feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership.membership_id configmanagement { - version = "1.19.0" + # Don't use the `version` field with Config Sync auto-upgrades. + # To disable Config Sync auto-upgrades, you need to set the field `management` to + # `MANAGEMENT_MANUAL` if it has been set previously. Removing the field does not work. + management= "MANAGEMENT_AUTOMATIC" config_sync { + # The field `enabled` was introduced in Terraform version 5.41.0, and + # needs to be set to `true` explicitly to install Config Sync. enabled = true - git { - sync_repo = "https://github.com/hashicorp/terraform" - } } } } ``` -## Example Usage - Config Management with OCI + +## Example Usage - Config Management with Git ```hcl resource "google_container_cluster" "cluster" { @@ -85,31 +91,15 @@ resource "google_gke_hub_feature_membership" "feature_member" { version = "1.19.0" config_sync { enabled = true - oci { - sync_repo = "us-central1-docker.pkg.dev/sample-project/config-repo/config-sync-gke:latest" - policy_dir = "config-connector" - sync_wait_secs = "20" - secret_type = "gcpserviceaccount" - gcp_service_account_email = "sa@project-id.iam.gserviceaccount.com" + git { + sync_repo = "https://github.com/hashicorp/terraform" } } } } ``` -## Example Usage - Multi Cluster Service Discovery - -```hcl -resource "google_gke_hub_feature" "feature" { - name = "multiclusterservicediscovery" - location = "global" - labels = { - foo = "bar" - } -} -``` - -## Example Usage - Service Mesh +## Example Usage - Config Management with OCI ```hcl resource "google_container_cluster" "cluster" { @@ -128,16 +118,30 @@ resource "google_gke_hub_membership" "membership" { } resource "google_gke_hub_feature" "feature" { - name = "servicemesh" + name = "configmanagement" location = "global" + + labels = { + foo = "bar" + } } resource "google_gke_hub_feature_membership" "feature_member" { location = "global" feature = google_gke_hub_feature.feature.name membership = google_gke_hub_membership.membership.membership_id - mesh { - management = "MANAGEMENT_AUTOMATIC" + configmanagement { + version = "1.19.0" + config_sync { + enabled = true + oci { + sync_repo = "us-central1-docker.pkg.dev/sample-project/config-repo/config-sync-gke:latest" + policy_dir = "config-connector" + sync_wait_secs = "20" + secret_type = "gcpserviceaccount" + gcp_service_account_email = "sa@project-id.iam.gserviceaccount.com" + } + } } } ``` @@ -187,6 +191,51 @@ resource "google_gke_hub_feature_membership" "feature_member" { } ``` +## Example Usage - Multi Cluster Service Discovery + +```hcl +resource "google_gke_hub_feature" "feature" { + name = "multiclusterservicediscovery" + location = "global" + labels = { + foo = "bar" + } +} +``` + +## Example Usage - Service Mesh + +```hcl +resource "google_container_cluster" "cluster" { + name = "my-cluster" + location = "us-central1-a" + initial_node_count = 1 +} + +resource "google_gke_hub_membership" "membership" { + membership_id = "my-membership" + endpoint { + gke_cluster { + resource_link = "//container.googleapis.com/${google_container_cluster.cluster.id}" + } + } +} + +resource "google_gke_hub_feature" "feature" { + name = "servicemesh" + location = "global" +} + +resource "google_gke_hub_feature_membership" "feature_member" { + location = "global" + feature = google_gke_hub_feature.feature.name + membership = google_gke_hub_membership.membership.membership_id + mesh { + management = "MANAGEMENT_AUTOMATIC" + } +} +``` + ## Example Usage - Policy Controller with minimal configuration ```hcl