Apply different infrastructure to different environments

I’m sure I am missing something trivial here that is not making me understand how this can be used. As an example, within my ECS module for instance I use something like this:

desired_count = (lower(terraform.workspace) == "prod") ? 2 : 1

Which is how I differentiate how many ECS tasks I want to run, I do similar things with RDS etc. But if I was to pass in a value as to your example into my vpc module to create a single subnet for dev and two subnets for prod, I’m still not sure how to achieve that.

Is there a ‘if blah then blah else blah’ syntax in terraform I’m not seeing?