Skip to content

Commit

Permalink
add nil check to nodepool management flattener (#12037) (#19922)
Browse files Browse the repository at this point in the history
[upstream:689ae847b95db96abe9713be33b5cd724b5309e6]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Oct 18, 2024
1 parent 71c538f commit 34792dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .changelog/12037.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
container: fixed a crash in `google_container_node_pool` caused by an occasional nil pointer
```
12 changes: 7 additions & 5 deletions google/services/container/resource_container_node_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1195,11 +1195,13 @@ func flattenNodePool(d *schema.ResourceData, config *transport_tpg.Config, np *c
nodePool["max_pods_per_node"] = np.MaxPodsConstraint.MaxPodsPerNode
}

nodePool["management"] = []map[string]interface{}{
{
"auto_repair": np.Management.AutoRepair,
"auto_upgrade": np.Management.AutoUpgrade,
},
if np.Management != nil {
nodePool["management"] = []map[string]interface{}{
{
"auto_repair": np.Management.AutoRepair,
"auto_upgrade": np.Management.AutoUpgrade,
},
}
}

if np.UpgradeSettings != nil {
Expand Down

0 comments on commit 34792dd

Please sign in to comment.