fix: handle null undrainable_node_behavior in precondition validation#763
Open
lonegunmanb wants to merge 3 commits intomainfrom
Open
fix: handle null undrainable_node_behavior in precondition validation#763lonegunmanb wants to merge 3 commits intomainfrom
lonegunmanb wants to merge 3 commits intomainfrom
Conversation
The contains() function in Terraform does not accept null arguments, and Terraform does not short-circuit || evaluation. When undrainable_node_behavior is explicitly set to null, try() passes null through (since accessing a null attribute is not an error), causing contains() to crash with 'argument must not be null'. Fix by wrapping with coalesce() to convert null to an empty string before passing to contains(). Also harden the blob driver subnet check in main.tf with the same pattern. Fixes #760 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9b0e388 to
3980c7d
Compare
…gress example Zone 2 is not supported for AKS node pools in westeurope. Change to zone 3 which is the only supported zone for this region. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ilability The australiasoutheast region hits Total Regional Cores quota limits (Required: 12, Limit: 10). Switch to eastus which has sufficient quota. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix
Resolves #760
Problem
When
undrainable_node_behavioris explicitly set tonullinsideupgrade_settingsfor extra node pools,terraform plancrashes with:Error: Invalid function argument contains(list, value) Invalid value for "value" parameter: argument must not be null.Root Cause
In
extra_node_pool.tflines 183 and 350, the precondition uses:Two Terraform behaviors combine to cause this:
try()passes null through — accessing a null-valued attribute is not an error, sotry(null, "")returnsnull, not"".||— all operands are evaluated before computing the logical result, socontains()receivesnulleven though an earlier clause would make the expressiontrue.Fix
Wrap with
coalesce()to convertnullto""before passing tocontains():Also hardened a similar theoretical edge case in
main.tf(blob driver subnet service endpoint check).Changes
extra_node_pool.tf: Fix null-safety in precondition on lines 183 and 350 (bothnode_pool_create_before_destroyandnode_pool_create_after_destroy)main.tf: Hardenservice_endpointsnull-safety in blob driver check (line 748)