title: How does terraform evaluates constants
body: <p>How does terraform evaluate constants?</p>
  <p>My team has below terraform code.</p>
  <pre><code># main.tf file
  locals {
    resource_prefix      = var.resource_context.constants.resource_prefix
    virtual_network_name = &quot;${local.resource_prefix}MainVNet&quot;
    subnets = {
      (var.subnet_keys.test1)      = &quot;${local.resource_prefix}SubnetTest1&quot;,
      (var.subnet_keys.test2)      = &quot;${local.resource_prefix}SubnetTest2&quot;,
      (var.subnet_keys.test3)      = &quot;${local.resource_prefix}SubnetTest3&quot;,
      (var.subnet_keys.test4)      = &quot;${local.resource_prefix}SubnetTest4&quot;,
      (var.subnet_keys.test5)      = &quot;${local.resource_prefix}SubnetTest5&quot;
      (var.subnet_keys.test6)      = &quot;${local.resource_prefix}SubnetTest6&quot;
    }
  }
  
  data &quot;azurerm_virtual_network&quot; &quot;vnet&quot; {
    name                = local.virtual_network_name
    resource_group_name = var.resource_context.resource_group.name
  }
  
  data &quot;azurerm_subnet&quot; &quot;subnets&quot; {
    for_each             = local.subnets
    name                 = each.value
    resource_group_name  = var.resource_context.resource_group.name
    virtual_network_name = data.azurerm_virtual_network.vnet.name
  }
  
  </code></pre>
  <pre><code># variables.tf file
  
  variable &quot;resource_context&quot; {}
  variable &quot;subnet_keys&quot; {
    type = object({
      test1      = string
      test2      = string
      test3      = string
      test4      = string
      test5      = string
      test6      = string
    })
  }
  
  
  </code></pre>
  <p>I just want to know how terraform evaluates local variable resource_prefix in main.tf, I mean, suffix part of the local variable &quot;constants.resource_prefix&quot;. Is there any special significance of it in that variable?</p>
  <p>Its final value for one of the variable &quot;${local.resource_prefix}SubnetTest1&quot; will be
  DevLabCu0SubnetTest1</p>