A conditional expression chooses between two results using a boolean condition. The syntax is condition, a question mark, the true result, a colon and the false result. Terraform needs compatible result types so it can determine the expression’s type.
Keep the condition separate from the business value it selects: zero replicas can be a deliberate result when a service is disabled. The common mistake is reversing the branches, which produces valid HCL and the opposite behavior. Test both sides of the condition. A single enabled example cannot show whether the disabled path is correct.
The disabled branch deliberately returns zero.