by FrenchyJiby · 1y ago · 0 comments
Then sure sprinkle a few per-env-toggles `count: 1 if env == dev else 0` (or whatever the latest nicest way to do that is today), but it feels weird to have to set up an artificial TF module around our entire codebase to be able to share the bulk of the code?
module "cool_name" {
count = var.create_cool_name ? 1 : 0
}
I've always wanted a simple enable/disable syntax for modules in tf.Does TF support count on modules now?! The pattern I was referring to is akin to having an `enabled` var that you define in _every_ module (there are ways to make this easier to do [0]) and inside of each module you have a
local {
make_the_s3_bucket = var.enabled && var.make_s3_bucket
make_the_rds_instance = var.enabled && var.enable_rds
}
Then you use the typical `count: foo == bar ? 1:0` trick where some part of the `foo/bar` conditional ropes in local.make_the_rds_instance[0]: https://github.com/cloudposse/terraform-null-label/tree/main