title: Terraform provider/variable sharing in modules
body: <p>Is there a way of abstracting the provider for all the modules defined in a project.</p>
  
  <p>for example, I have this project</p>
  
  <pre><code>├── modules
  │   ├── RDS
  │   └── VPC
  └── stacks
      ├── production
      │   └── main.tf
      └── staging
          └── main.tf
  </code></pre>
  
  <p>and it works fine...
  the problem is with the definition of modules</p>
  
  <pre><code>├── RDS
  │   ├── README.md
  │   ├── main.tf
  │   ├── providers.tf
  │   └── variables.tf
  └── VPC
      ├── README.md
      ├── main.tf
      ├── providers.tf
      └── variables.tf
  </code></pre>
  
  <p>the provider in both of these modules are exactly the same</p>
  
  <pre><code># providers.tf
  provider "aws" {
    region = "${var.region}"
    version = "~&gt; 1.26"
  }
  </code></pre>
  
  <p>and the variables in each module are different but they all have the <code>region</code> variable.</p>
  
  <pre><code># variables.tf
  variable "region" {
    default     = "eu-central-1"
    description = "AWS region."
  }
  # other module dependent variables...
  </code></pre>
  
  <p>is there a way to define those bits of information on the modules level
  so that I end up with something roughly like this</p>
  
  <pre><code>├── modules
  │   ├── providers.tf  &lt;&lt;&lt; include the *shared* provider definition block
  │   ├── variables.tf  &lt;&lt;&lt; include the *shared* region vaiable definition block
  │   ├── RDS
  │   │   ├── README.md
  │   │   ├── main.tf
  │   │   └── variables.tf
  │   └── VPC
  │       ├── README.md
  │       ├── main.tf
  │       └── variables.tf
  </code></pre>
  
  <p>one last thing, the modules definitions most of the time have a resource attribute (pulling a module from the terraform registry... therefore I don't know if it's feasible to inherit both the source from the registry and a base module)</p>