Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

potential fix for gke provider upgrade problem #4706

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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