Skip to content

Commit

Permalink
potential fix for gke provider upgrade problem (#6546) (#4706)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Sep 21, 2022
1 parent aa1764f commit e0fe951
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .changelog/6546.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
container: fixed a bug where upgrading provider version breaks on `node_pool_auto_config` or `node_pool_defaults`
```
23 changes: 13 additions & 10 deletions google-beta/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ func clusterSchemaNodeConfig() *schema.Schema {
// overridden if specified on the specific NodePool object.
func clusterSchemaNodePoolDefaults() *schema.Schema {
return &schema.Schema{
Type: schema.TypeList,
Optional: true,
DiffSuppressFunc: emptyOrUnsetBlockDiffSuppress,
Description: `The default nodel pool settings for the entire cluster.`,
MaxItems: 1,
Type: schema.TypeList,
Optional: true,
Computed: true,
Description: `The default nodel pool settings for the entire cluster.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"node_config_defaults": {
Expand Down Expand Up @@ -1013,11 +1013,11 @@ func resourceContainerCluster() *schema.Resource {
"node_pool_defaults": clusterSchemaNodePoolDefaults(),

"node_pool_auto_config": {
Type: schema.TypeList,
Optional: true,
DiffSuppressFunc: emptyOrUnsetBlockDiffSuppress,
MaxItems: 1,
Description: `Node pool configs that apply to all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.`,
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Description: `Node pool configs that apply to all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"network_tags": {
Expand Down Expand Up @@ -4097,10 +4097,12 @@ func flattenNodePoolDefaults(c *container.NodePoolDefaults) []map[string]interfa
if c == nil {
return nil
}

result := make(map[string]interface{})
if c.NodeConfigDefaults != nil && c.NodeConfigDefaults.GcfsConfig != nil {
result["node_config_defaults"] = flattenNodeConfigDefaults(c.NodeConfigDefaults)
}

return []map[string]interface{}{result}
}

Expand Down Expand Up @@ -4709,6 +4711,7 @@ func flattenNodePoolAutoConfig(c *container.NodePoolAutoConfig) []map[string]int
if c.NetworkTags != nil {
result["network_tags"] = flattenNodePoolAutoConfigNetworkTags(c.NetworkTags)
}

return []map[string]interface{}{result}
}

Expand Down

0 comments on commit e0fe951

Please sign in to comment.