title: Case statement in terraform?
body: <p>Hi I have below block of terraform code which creates for me Virtual machines for sql and app roles.</p>
  
  <pre><code>module "sql_vms" {
    source                = "../../modules/compute/"
    rg_name               = var.resource_group_name
    location              = module.resource_group.external_rg_location
    vnet_name             = var.virtual_network_name
    subnet_name           = var.sql_subnet_name
    app_nsg               = var.application_nsg
    vm_count              = var.count_vm
    base_hostname         = var.sql_host_basename
    sto_acc_suffix        = var.storage_account_suffix
    vm_size               = var.virtual_machine_size
    vm_publisher          = var.virtual_machine_image_publisher
    vm_offer              = var.virtual_machine_image_offer
    vm_sku                = var.virtual_machine_image_sku
    vm_img_version        = var.virtual_machine_image_version
    username              = var.username
    password              = var.password
    allowed_source_ips    = var.ip_list
  }
  
  module "app_vms" {
    source                = "../../modules/compute/"
    rg_name               = var.resource_group_name
    location              = module.resource_group.external_rg_location
    vnet_name             = var.virtual_network_name
    subnet_name           = var.sql_subnet_name
    app_nsg               = var.application_nsg
    vm_count              = var.count_vm
    base_hostname         = var.app_host_basename
    sto_acc_suffix        = var.storage_account_suffix
    vm_size               = var.virtual_machine_size
    vm_publisher          = var.virtual_machine_image_publisher
    vm_offer              = var.virtual_machine_image_offer
    vm_sku                = var.virtual_machine_image_sku
    vm_img_version        = var.virtual_machine_image_version
    username              = var.username
    password              = var.password
    allowed_source_ips    = var.ip_list
  }
  
  module "resource_group" {
    source                = "../../modules/resourcegroup/"
    rg_name               = "test_rg"
  }
  </code></pre>
  
  <p>Whilst it helps me get the job done. I don't think this is ideal as there are lot of common parameters and only few which change to create a different roles</p>
  
  <p>Parameters specific to roles are below:</p>
  
  <pre><code>subnet_name
  vm_size
  vm_publisher
  vm_offer
  vm_sku
  vm_img_version
  </code></pre>
  
  <p>Possible to do in terraform a case statement or perhaps a loop?</p>