Terraform 0.13 ignoring module using `count = 0`

Hey, I’m looking to conditionally include a module that has a provider declared using its resources. Is there a way to exclude this module based on a variable? Such as create_db = bool? Thanks!

Hi @JesterOrNot,

From the summary of this topic it seems like you are close to the answer! You can use count to choose between having zero or one instances of the module, like this:

module "example" {
  count = var.create_db ? 1 : 0

  # ...
}

Thank you so much! The problem is that you can’t have a provider declared in the same module.