title: Can I include or exclude modules based on variables?
body: <p>I have the following use case:</p>
  
  <ul>
  <li>An application is deployed in various versions.</li>
  <li>Across those versions some resources stay the same, some change</li>
  <li>I need to be able to tear down individual versions</li>
  </ul>
  
  <p>Let's see an example configuration:</p>
  
  <pre><code>variable "majorVersion" {
    type        = "string"
  }
  
  module "media-assets" {
    majorVersion   = "${var.majorVersion}"
    input_bucket   = "uploads-${var.majorVersion}"
    source         = "./modules/media-assets"
  }
  </code></pre>
  
  <p>Now assume I want to deploy another version, which adds to it's configuration another module: </p>
  
  <pre><code>module "sns" {
    url    = "https://my-api-${var.majorVersion}.xyz.com/sns"
    source = "./modules/sns"
  }
  </code></pre>
  
  <p>Since v1 does not require this resource, creating it for v1 would be undesirable. Can I still run this script for majorVersion=v1 after adding the latter part without terraform creating sns resources? Is there a way I can control based on a variable which modules are included and which are not? </p>