'Terraform count using bool?

count is a great meta-argument for being able to provision resources conditionally in Terraform. From my previous experience, we do something like my_var = "1" and use this to programmatically control resource creation with count.

Since count in that case takes in a string "1", but can also interpret a number type (e.g. 1), I'm wondering:

a) What is Terraform's count doing under the hood; is it parsing the string as a number first?
b) Can it also accept other data types e.g. bool?

I'm hoping to have a .tfvars which has a my_var = true in it, which is then passed into the count meta-argument on affected resources e.g count = var.my_var. Is this possible?


I also kindly request some information which goes into generally how data types are interpreted in Terraform for "truthiness". If you have docs or a blog post to share it'd be much appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source