From the course: HashiCorp Certified: Terraform Associate (003) Cert Prep by KodeKloud

Unlock this course with a free trial

Join today to access over 23,400 courses taught by industry experts.

Operators and conditional expressions

Operators and conditional expressions

- [Instructor] In this lecture, we will take a look at some of the common operators and then conditional expressions in Terraform. In the previous lecture, we saw how to test functions using the terraform console command, and that's not the only use of it. We can also make use of arithmetic and logical operations with Terraform and test the same using the Terraform console command. For example, we can make use of arithmetic operations like these by making use of arithmetic operators. Besides arithmetic, Terraform also supports equality, logical and comparison operators. Equality operators take two values of any data type and produce a Boolean result of true or false. To check if two values are exactly equal, we can make use of double equals operator like this. The exclamation equal to operator does the reverse and it prints a value of true if the two values are not equal. In this example, the comparison result produces false as the value on the left of the operator is a number and the…

Contents