A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.hashicorp.com/terraform/language/functions/abs below:

abs - Functions - Configuration Language | Terraform

This topic provides reference information about the abs function. The abs function returns the absolute value of the given number.

The abs function returns the absolute value of the given number. If the number is zero or positive, the function returns the value as-is, but if it is negative, it is multiplied by -1 to make it positive before returning it.

Use the abs function with the following syntax:

The number argument is the number you want the absolute value of.

In the following example, the function returns the absolute value of 23, 0, and -12.4.

$ abs(23)
23
$ abs(0)
0
$ abs(-12.4)
12.4

The following example defines a variable num that is negative. The function outputs the absolute value of num, which is 10.

variable "num" {
  default = -10
}

output "absolute_value" {
  value = abs(var.num)
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4