3

How do we select or disable modules in root main.tf

Example:

module "foo" {
  source = "bar"
  count   = "${var.include_module ? 1 : 0}"

}

Above one does not work, as per terraform issue discussion link

Any alternate method ?

Vidya
  • 179
  • 1
  • 2
  • 12

1 Answers1

10

What version of Terraform are you using? count and for_each for modules were introduced in Terraform version 0.13.0.

Note that the interpolation syntax you're using is deprecated. Use:

count = var.include_module ? 1 : 0
Jordan
  • 3,998
  • 9
  • 45
  • 81