top | item 29303236

(no title)

edgan | 4 years ago

He has a real point, but it doesn't really give a good alternative other than "read my book".

The crux of the problem when writing Terraform code is that it doesn't have if statements. Without them you end up doing hacky things to try to recreate them. Environments are not all going to be exact replicas of each other for 100 different reasons, and so trying to use the exact same code for each just doesn't work.

I don't consider dynamic/for_each an elegant solution with the current syntax.

discuss

order

jb_s|4 years ago

Haven't used Terraform - ARM templates have a workable (though not elegant) expression system where you can use parameters to resolve stuff - so you indeed have one IaC definition and use your CI/CD to set parameter values and therefore setup whatever is needed for different environments. So your CI/CD knows about the envs and not the IaC code. As it should be I think.