tencent cloud

Tencent Infrastructure Automation for Terraform

Product Introduction
Overview
Strengths
Scenarios
Purchase Guide
Getting Started
Use Terraform in Local PC
User Guide
Configuration Guide
Syntax Guide
Resource List
Combination with DevOps
Code Management
Continuous Integration and Deployment
Use Cases
Deploying Cloud Native Service
Cross-Region Replication of Resources
Case Studies
Convertlab's IaC Practices Based on Tencent Cloud for Terraform
Provider Contributor Guide
Welcome
Contribute
Developer Reference
FAQs
Signature Error
Init Acceleration
Enabling Log Tracking
Managing Existing Resource
State Lock

Expression

PDF
Modo Foco
Tamanho da Fonte
Última atualização: 2024-12-02 16:01:33

Operators

Operators are used for arithmetic or logical operations.

Arithmetic operators

Operator
Description
a + b
Returns the result of adding a and b together.
a - b
Returns the result of subtracting b from a.
a * b
Returns the result of multiplying a and b.
a / b
Returns the result of dividing a by b.
a % b
Returns the remainder of dividing a by b. This operator is generally useful only when used with whole numbers.
-a
Returns the result of multiplying a by -1.


Comparison operators

Operator
Description
a == b
Returns true if a and b both have the same type and the same value, or false otherwise.
a != b
Contrary to ==.
a < b
Returns true if a is less than b, or false otherwise.
a > b
Returns true if a is greater than b, or false otherwise.
a <= b
Returns true if a is less than or equal to b, or false otherwise.
a >= b
Returns true if a is greater than or equal to b, or false otherwise.


Logical operators

Operator
Description
a || b
Returns true if either a or b is true, or false if both are false.
a && b
Returns true if both a and b are true, or false if either one is false.
!a
Returns true if a is false, or false if a is true.


Conditional Expression

A conditional expression uses the value of a Boolean expression to select one of two values. For example:
condition ? one_value : two_value

for Expression

A for expression can be used to traverse a set of collections and map one collection type to another. For example:
[for item in items : upper(item)]

Splat Expression

A splat expression provides a more concise way to express a common operation that could otherwise be performed with a for expression. For example:
[for o in var.list : o.id]
is equivalent to
var.list[*].id

Function Expression

Terraform supports the use of some built-in functions when expressions are calculated. An expression to call a function is similar to an operator. For example:
upper("123")


Ajuda e Suporte

Esta página foi útil?

comentários