Numeric Functions
In this section, you will look at some of the most common functions that work with numeric arguments. Numeric functions will help in cases where you might need to select the smallest value from the given list of values and process accordingly or convert the string representation of the given value to a number to perform some arithmetic operations using the same. It will be clearer once you go through the different functions supported by Terraform with sample inputs.
The examples used in this section will be available with the filename 1. numeric-functions.txt
in the GitHub link provided at the start of this chapter. You just need to take the specific command and try it with your sample inputs in the terraform
console
terminal.
The abs() Function
The abs()
function always returns the absolute value of the given number, and it takes only one argument. If the input number is less than zero (0
), the value will be multiplied by -1 and then returned. If the input...