title: Terraform combine 2 variables into a new variable
body: <p>I want to automate deployments of Vmware VM's in an landscape with lots of portgroups. To be able to select the correct portgroup it would be best to  enter 2 variables tenant and environment. These 2 variables are used for CMDB registration and deployment purposes. </p>
  
  <p>For the deployment the variables need to be combined in to 1 new variable to pick the correct portgroup. Due to interpolation syntax it seems to be impossible to use 2 combined variables in the lookup.</p>
  
  <p>How can I combine 2 variables to 1 in Terraform?</p>
  
  <p>I also tried to make a local file with the correct string, but that file needs to exist before the script starts, terraform plan gives a error message that the file doesn't exist.</p>
  
  <pre><code>variable "tenant" {
    description = "tenant: T1 or T2"
  }
  
  variable "environment" {
    description = "environment: PROD or TEST"
  }
  
  variable "vm_network" {
    description = "network the VM will be provisioned with"
    type = "map"
    default = {
      T1_PROD = "T1-PROD-network"
      T2_PROD = "T2-PROD-network"
      T1_TEST = "T1-TEST-network"
      T2_TEST = "T2-TEST-network"
    }
  }
  
  data "vsphere_network" "network" {
    name          = "${lookup(var.vm_network, tenant_environment)}"
    datacenter_id = "${data.vsphere_datacenter.dc.id}"
  }
  </code></pre>