Skip to content

Commit

Permalink
Added nil guard to blue green settings in google_container_node_pool (G…
Browse files Browse the repository at this point in the history
  • Loading branch information
rileykarson authored May 23, 2023
1 parent 2251132 commit 1abde7a
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1665,13 +1665,14 @@ func nodePoolUpdate(d *schema.ResourceData, meta interface{}, nodePoolInfo *Node

if v, ok := blueGreenSettingsConfig["standard_rollout_policy"]; ok && len(v.([]interface{})) > 0 {
standardRolloutPolicy := &container.StandardRolloutPolicy{}
standardRolloutPolicyConfig := v.([]interface{})[0].(map[string]interface{})
standardRolloutPolicy.BatchSoakDuration = standardRolloutPolicyConfig["batch_soak_duration"].(string)
if v, ok := standardRolloutPolicyConfig["batch_node_count"]; ok {
standardRolloutPolicy.BatchNodeCount = int64(v.(int))
}
if v, ok := standardRolloutPolicyConfig["batch_percentage"]; ok {
standardRolloutPolicy.BatchPercentage = v.(float64)
if standardRolloutPolicyConfig, ok := v.([]interface{})[0].(map[string]interface{}); ok {
standardRolloutPolicy.BatchSoakDuration = standardRolloutPolicyConfig["batch_soak_duration"].(string)
if v, ok := standardRolloutPolicyConfig["batch_node_count"]; ok {
standardRolloutPolicy.BatchNodeCount = int64(v.(int))
}
if v, ok := standardRolloutPolicyConfig["batch_percentage"]; ok {
standardRolloutPolicy.BatchPercentage = v.(float64)
}
}
blueGreenSettings.StandardRolloutPolicy = standardRolloutPolicy
}
Expand Down

0 comments on commit 1abde7a

Please sign in to comment.