From cce9f13d18d4ff35d8ab9741c457cd2610de4d30 Mon Sep 17 00:00:00 2001 From: Jiaxun Song Date: Tue, 25 Jul 2023 13:02:19 -0700 Subject: [PATCH] move gcs_fuse_csi_driver_config to GA (#8411) --- .../resource_container_cluster.go.erb | 66 +++++++++---------- .../resource_container_cluster_test.go.erb | 12 ++-- .../docs/r/container_cluster.html.markdown | 2 +- 3 files changed, 39 insertions(+), 41 deletions(-) diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster.go.erb b/mmv1/third_party/terraform/services/container/resource_container_cluster.go.erb index 7f411fa34bc6..63c3191b9a5e 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster.go.erb +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster.go.erb @@ -79,10 +79,10 @@ var ( "addons_config.0.gce_persistent_disk_csi_driver_config", "addons_config.0.gke_backup_agent_config", "addons_config.0.config_connector_config", + "addons_config.0.gcs_fuse_csi_driver_config", <% unless version == 'ga' -%> "addons_config.0.istio_config", "addons_config.0.kalm_config", - "addons_config.0.gcs_fuse_csi_driver_config", <% end -%> } @@ -402,6 +402,23 @@ func ResourceContainerCluster() *schema.Resource { }, }, }, + "gcs_fuse_csi_driver_config": { + Type: schema.TypeList, + Optional: true, + Computed: true, + AtLeastOneOf: addonsConfigKeys, + MaxItems: 1, + Description: `The status of the GCS Fuse CSI driver addon, which allows the usage of gcs bucket as volumes. Defaults to disabled; set enabled = true to enable.`, + ConflictsWith: []string{"enable_autopilot"}, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Required: true, + }, + }, + }, + }, <% unless version == 'ga' -%> "istio_config": { Type: schema.TypeList, @@ -444,23 +461,6 @@ func ResourceContainerCluster() *schema.Resource { }, }, }, - "gcs_fuse_csi_driver_config": { - Type: schema.TypeList, - Optional: true, - Computed: true, - AtLeastOneOf: addonsConfigKeys, - MaxItems: 1, - Description: `The status of the GCS Fuse CSI driver addon, which allows the usage of gcs bucket as volumes. Defaults to disabled; set enabled = true to enable.`, - ConflictsWith: []string{"enable_autopilot"}, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "enabled": { - Type: schema.TypeBool, - Required: true, - }, - }, - }, - }, <% end -%> "config_connector_config": { Type: schema.TypeList, @@ -4077,6 +4077,13 @@ func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig { ForceSendFields: []string{"Enabled"}, } } + if v, ok := config["gcs_fuse_csi_driver_config"]; ok && len(v.([]interface{})) > 0 { + addon := v.([]interface{})[0].(map[string]interface{}) + ac.GcsFuseCsiDriverConfig = &container.GcsFuseCsiDriverConfig{ + Enabled: addon["enabled"].(bool), + ForceSendFields: []string{"Enabled"}, + } + } <% unless version == 'ga' -%> if v, ok := config["istio_config"]; ok && len(v.([]interface{})) > 0 { @@ -4095,14 +4102,6 @@ func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig { ForceSendFields: []string{"Enabled"}, } } - - if v, ok := config["gcs_fuse_csi_driver_config"]; ok && len(v.([]interface{})) > 0 { - addon := v.([]interface{})[0].(map[string]interface{}) - ac.GcsFuseCsiDriverConfig = &container.GcsFuseCsiDriverConfig{ - Enabled: addon["enabled"].(bool), - ForceSendFields: []string{"Enabled"}, - } - } <% end -%> return ac @@ -5167,6 +5166,13 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac }, } } + if c.GcsFuseCsiDriverConfig != nil { + result["gcs_fuse_csi_driver_config"] = []map[string]interface{}{ + { + "enabled": c.GcsFuseCsiDriverConfig.Enabled, + }, + } + } <% unless version == 'ga' -%> if c.IstioConfig != nil { @@ -5185,14 +5191,6 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac }, } } - - if c.GcsFuseCsiDriverConfig != nil { - result["gcs_fuse_csi_driver_config"] = []map[string]interface{}{ - { - "enabled": c.GcsFuseCsiDriverConfig.Enabled, - }, - } - } <% end -%> return []map[string]interface{}{result} } diff --git a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb index 584f5f8145bd..7f2fde353110 100644 --- a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb @@ -4011,6 +4011,9 @@ resource "google_container_cluster" "primary" { config_connector_config { enabled = false } + gcs_fuse_csi_driver_config { + enabled = false + } <% unless version == 'ga' -%> istio_config { disabled = true @@ -4019,9 +4022,6 @@ resource "google_container_cluster" "primary" { kalm_config { enabled = false } - gcs_fuse_csi_driver_config { - enabled = false - } <% end -%> } } @@ -4075,6 +4075,9 @@ resource "google_container_cluster" "primary" { config_connector_config { enabled = true } + gcs_fuse_csi_driver_config { + enabled = true + } <% unless version == 'ga' -%> istio_config { disabled = false @@ -4083,9 +4086,6 @@ resource "google_container_cluster" "primary" { kalm_config { enabled = true } - gcs_fuse_csi_driver_config { - enabled = true - } <% end -%> } } diff --git a/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown b/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown index 73e5f7d485b6..9c25900ec9f0 100644 --- a/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown @@ -398,7 +398,7 @@ Enable/Disable Security Posture API features for the cluster. Structure is [docu which allows the usage of filestore instance as volumes. It is disabled by default; set `enabled = true` to enable. -* `gcs_fuse_csi_driver_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))) The status of the GCSFuse CSI driver addon, +* `gcs_fuse_csi_driver_config` - (Optional) The status of the GCSFuse CSI driver addon, which allows the usage of a gcs bucket as volumes. It is disabled by default; set `enabled = true` to enable.