Avoiding "if" conditions in Cf templates

Hello, What can I do to avoid having if conditions in my CF templates?

Can you state this differently with regards to the problem you are having?

We have some templates per environment, even if duplicate and some are “global”. We want to be able to write global templates as much as possible but something, there are some differences between environments.
Personally, I don’t like a generic template because resources can be added/change per environment, leading to conditional value/properties.
I know there is mapping though, but it cannot be used everytime

Nested templates are one solution - you have the generic template that applies all the inputs, and then the parent template has the if/else logic to determine what to pass to the child

Some thoughts:
• You pretty much want to use Mappings and Conditions
• Your environments should almost be 1:1 with some rare (READ: 1 max) differences. If there is more than that then these aren’t the same env, and having different templates would be the right approach.
• You can release CFN private registry modules and pull in the modules you want.
• I would start with Mappings and Conditions 100% and go from there. If you find something that doesn’t work well or there are too many conditions, that would be the key to start looking for the more complex stuff.
Worst case, you can convert your template to js, and dynamically generate the sections which should be different.

Thank you for these options. I expected that. I need to “standardize” all the templates…