using terraform expression
Terraform expression consist of conditional operators like ==, != and functions that you can leverage to work with input values. For example, lets say you want to concatenate two variable together, you can do that using terraform.
There are a whole lot of functions available which are categorized under string, numeric and collection functions.
Lets have a look at where you can use these functions. Functions are typically classified as expresssion and you can use it within a terraform code.
Example
Let's have a look at the example below :-
In this example, i am combining a couple of function together (chaining) and produce a list as the final output. This snippet shows where we can :-
Disecting the code out further, we have substr functions, which attempts to get a subsection of a string except the last character.
substr(data.azurerm_storage_account.paymentmonitorui.primary_web_endpoint,
0, length
(data.azurerm_storage_account.paymentmonitorui.primary_web_endpoint) - 1)
Then we have compact which merge one or more list element together while dropping empty list element:-
Please refer to code snippet above.
Comments