From ef26f20191b8b32d9ec22cf7f26e5c1c44878d78 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 14 Dec 2023 12:09:28 -0800 Subject: [PATCH] Revert "The version field should be under configmanagement instead of under oci" (#9645) (#16802) [upstream:617cca41c65236cbbb39730359cdcda653fde17a] Signed-off-by: Modular Magician --- .changelog/9645.txt | 3 ++ .../gkehub2/resource_gke_hub_feature.go | 44 +++++++++---------- .../gkehub2/resource_gke_hub_feature_test.go | 2 - website/docs/r/gke_hub_feature.html.markdown | 8 ++-- 4 files changed, 29 insertions(+), 28 deletions(-) create mode 100644 .changelog/9645.txt diff --git a/.changelog/9645.txt b/.changelog/9645.txt new file mode 100644 index 00000000000..640a4eae004 --- /dev/null +++ b/.changelog/9645.txt @@ -0,0 +1,3 @@ +```release-note:bug +gkehub2: added field `version` under `configmanagement` instead of a child field `oci` in `google_gke_hub_feature` resource (revert) +``` diff --git a/google/services/gkehub2/resource_gke_hub_feature.go b/google/services/gkehub2/resource_gke_hub_feature.go index 6516b6f0611..204a1dbe319 100644 --- a/google/services/gkehub2/resource_gke_hub_feature.go +++ b/google/services/gkehub2/resource_gke_hub_feature.go @@ -164,6 +164,11 @@ func ResourceGKEHub2Feature() *schema.Resource { Optional: true, Description: `Period in seconds between consecutive syncs. Default: 15`, }, + "version": { + Type: schema.TypeString, + Optional: true, + Description: `Version of ACM installed`, + }, }, }, }, @@ -175,11 +180,6 @@ func ResourceGKEHub2Feature() *schema.Resource { }, }, }, - "version": { - Type: schema.TypeString, - Optional: true, - Description: `Version of ACM installed`, - }, }, }, }, @@ -1142,16 +1142,10 @@ func flattenGKEHub2FeatureFleetDefaultMemberConfigConfigmanagement(v interface{} return nil } transformed := make(map[string]interface{}) - transformed["version"] = - flattenGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementVersion(original["version"], d, config) transformed["config_sync"] = flattenGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSync(original["configSync"], d, config) return []interface{}{transformed} } -func flattenGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementVersion(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - func flattenGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSync(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return nil @@ -1251,6 +1245,8 @@ func flattenGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSyncOci( flattenGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSyncOciGcpServiceAccountEmail(original["gcpServiceAccountEmail"], d, config) transformed["sync_wait_secs"] = flattenGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSyncOciSyncWaitSecs(original["syncWaitSecs"], d, config) + transformed["version"] = + flattenGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSyncOciVersion(original["version"], d, config) return []interface{}{transformed} } func flattenGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSyncOciSyncRepo(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { @@ -1273,6 +1269,10 @@ func flattenGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSyncOciS return v } +func flattenGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSyncOciVersion(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + func flattenGKEHub2FeatureFleetDefaultMemberConfigPolicycontroller(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return nil @@ -1860,13 +1860,6 @@ func expandGKEHub2FeatureFleetDefaultMemberConfigConfigmanagement(v interface{}, original := raw.(map[string]interface{}) transformed := make(map[string]interface{}) - transformedVersion, err := expandGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementVersion(original["version"], d, config) - if err != nil { - return nil, err - } else if val := reflect.ValueOf(transformedVersion); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["version"] = transformedVersion - } - transformedConfigSync, err := expandGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSync(original["config_sync"], d, config) if err != nil { return nil, err @@ -1877,10 +1870,6 @@ func expandGKEHub2FeatureFleetDefaultMemberConfigConfigmanagement(v interface{}, return transformed, nil } -func expandGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementVersion(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return v, nil -} - func expandGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSync(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { @@ -2062,6 +2051,13 @@ func expandGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSyncOci(v transformed["syncWaitSecs"] = transformedSyncWaitSecs } + transformedVersion, err := expandGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSyncOciVersion(original["version"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedVersion); val.IsValid() && !tpgresource.IsEmptyValue(val) { + transformed["version"] = transformedVersion + } + return transformed, nil } @@ -2085,6 +2081,10 @@ func expandGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSyncOciSy return v, nil } +func expandGKEHub2FeatureFleetDefaultMemberConfigConfigmanagementConfigSyncOciVersion(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + func expandGKEHub2FeatureFleetDefaultMemberConfigPolicycontroller(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { diff --git a/google/services/gkehub2/resource_gke_hub_feature_test.go b/google/services/gkehub2/resource_gke_hub_feature_test.go index 803851f839a..44500ddfa82 100644 --- a/google/services/gkehub2/resource_gke_hub_feature_test.go +++ b/google/services/gkehub2/resource_gke_hub_feature_test.go @@ -402,7 +402,6 @@ resource "google_gke_hub_feature" "feature" { location = "global" fleet_default_member_config { configmanagement { - version = "1.16.0" config_sync { source_format = "hierarchy" git { @@ -429,7 +428,6 @@ resource "google_gke_hub_feature" "feature" { location = "global" fleet_default_member_config { configmanagement { - version = "1.16.1" config_sync { source_format = "unstructured" oci { diff --git a/website/docs/r/gke_hub_feature.html.markdown b/website/docs/r/gke_hub_feature.html.markdown index 18a67f990a9..2b42eba2d35 100644 --- a/website/docs/r/gke_hub_feature.html.markdown +++ b/website/docs/r/gke_hub_feature.html.markdown @@ -402,10 +402,6 @@ The following arguments are supported: The `configmanagement` block supports: -* `version` - - (Optional) - Version of ACM installed - * `config_sync` - (Optional) ConfigSync configuration for the cluster @@ -485,6 +481,10 @@ The following arguments are supported: (Optional) Period in seconds between consecutive syncs. Default: 15 +* `version` - + (Optional) + Version of ACM installed + The `policycontroller` block supports: * `version` -