antonbabenko / terraform-best-practices

Terraform Best Practices free ebook translated into 🇬🇧🇦🇪🇧🇦🇧🇷🇫🇷🇬🇪🇩🇪🇬🇷🇮🇱🇮🇳🇮🇩🇮🇹🇯🇵🇰🇷🇵🇱🇷🇴🇨🇳🇪🇸🇹🇷🇺🇦🇵🇰
https://www.terraform-best-practices.com/
Other
2.07k stars 431 forks source link

Naming conventions - possible mistake #19

Closed Dzhuneyt closed 2 years ago

Dzhuneyt commented 5 years ago

Describe the bug

I started reading the book and reached the following page: https://www.terraform-best-practices.com/naming

The following tip caught my eye:

To make inverted conditions don't introduce another variable unless really necessary, use 1 - boolean value instead. For example, count = "${1 - var.create_public_subnets}"

Shouldn't the count statement be the opposite? Meaning that if I pass "1" as the variable named "create_public_subnets", then the result of the mathematical operation would be "1-1=0", meaning count=0: don't create the resource. I would expect that passing var.create_public_subnets=1 will create the resource.

Dzhuneyt commented 5 years ago

@antonbabenko thoughts?

antonbabenko commented 2 years ago

I've just updated the book and code very much (recent version of Terraform, spelling mistakes, oops) - https://www.terraform-best-practices.com/

If there are any questions, please raise them here.

I or someone else will try to reply faster than in 2 years (sorry for that!)