Skip to content

Commit

Permalink
Revert "The version field should be under configmanagement instead of…
Browse files Browse the repository at this point in the history
… under oci" (#9645) (#16802)

[upstream:617cca41c65236cbbb39730359cdcda653fde17a]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored and shuyama1 committed Dec 14, 2023
1 parent b239600 commit 47f412a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .changelog/9645.txt
Original file line number Diff line number Diff line change
@@ -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)
```
44 changes: 22 additions & 22 deletions google/services/gkehub2/resource_gke_hub_feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
},
},
},
},
Expand All @@ -175,11 +180,6 @@ func ResourceGKEHub2Feature() *schema.Resource {
},
},
},
"version": {
Type: schema.TypeString,
Optional: true,
Description: `Version of ACM installed`,
},
},
},
},
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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{} {
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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
}

Expand All @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions google/services/gkehub2/resource_gke_hub_feature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions website/docs/r/gke_hub_feature.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,6 @@ The following arguments are supported:

<a name="nested_configmanagement"></a>The `configmanagement` block supports:

* `version` -
(Optional)
Version of ACM installed

* `config_sync` -
(Optional)
ConfigSync configuration for the cluster
Expand Down Expand Up @@ -485,6 +481,10 @@ The following arguments are supported:
(Optional)
Period in seconds between consecutive syncs. Default: 15

* `version` -
(Optional)
Version of ACM installed

<a name="nested_policycontroller"></a>The `policycontroller` block supports:

* `version` -
Expand Down

0 comments on commit 47f412a

Please sign in to comment.