-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Add signum interpolation function #4854
Add signum interpolation function #4854
Conversation
This function returns -1 for negative numbers, 0 for 0 and 1 for positive numbers. Useful when you need to set a value for the first resource and a different value for the rest of the resources. Example: `${element(split(",", var.r53_failover_policy), signum(count.index))}`
d615c48
to
c8795b8
Compare
* `signum(int)` - Returns -1 for negative numbers, 0 for 0 and 1 for positive numbers. | ||
This function is useful when you need to set a value for the first resource and | ||
a different value for the rest of the resources. | ||
Example: `element(split(",", var.r53_failover_policy), signum(count.index))` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind also mentioning the example from the issue? I think that would help users to better understand possible use-cases of this function.
i.e. I'd change this
Example:
element(split(",", var.r53_failover_policy), signum(count.index))
to
Example:
element(split(",", var.r53_failover_policy), signum(count.index))
where the zeroth index points toPRIMARY
and 1st toFAILOVER
Except one nitpick in docs this LGTM. |
Merging this, I will update the docs in a separate commit. Thanks for the PR! |
Add signum interpolation function
Thanks a lot! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This function returns -1 for negative numbers, 0 for 0 and 1 for positive numbers.
Useful when you need to set a value for the first resource and a different value for the rest of the resources.
Example:
${element(split(",", var.r53_failover_policy), signum(count.index))}
This closes the issue #4853 reported previously by myself.