title: Terraform - Resource doesn't not have attribute 'id when using slice function
body: <p>I'm using output from one module to pass it to another:</p>
  
  <pre><code>output "subnets_id_wan" {
    value       = "${azurerm_subnet.wan.*.id}"
      depends_on = [
      "azurerm_subnet.wan",
    ]
  }
  </code></pre>
  
  <p>In output i'm getting</p>
  
  <pre><code> security_groups_id_wan = [
      /subscriptions/111-222-333-4445/resourceGroups/default_resource_group/providers/Microsoft.Network/networkSecurityGroups/DF-DTAP-WAN-Subnet-Security-Group
      ]
  </code></pre>
  
  <p>i'm passing this output to network interface resource</p>
  
  <pre><code>#Create network interface
  
  resource "azurerm_network_interface" "public_ip" {
  
    count = "${var.enable_public_ip ? 1 : 0}"
    provider                  = "azurerm.base"
    name                      = "Network_Inteface_Public_IP_${var.env_name}_${var.azure_instance_names}"
    location                  = "${module.azure_vnet_dtap.resource_group_location}"
    resource_group_name       = "${module.azure_vnet_dtap.resource_group_name}"
    network_security_group_id = "${var.enable_security_group ? element(concat(azurerm_network_security_group.nsg.*.id,list("")),0) : element(concat(list("")),0)}"
  
  
    ip_configuration {
      name                          = "${var.env_name}_${var.ip_configuration_name}"
      #subnet_id                     = "${module.azure_vnet_dtap.subnets_id_single_wan}"
      subnet_id                     = "${element(module.azure_vnet_dtap.subnets_id_wan,count.index)}"
      private_ip_address_allocation = "${var.is_static_ip ? "static" : "dynamic"}"
      private_ip_address            = "${var.static_ip}"
      public_ip_address_id          = "${azurerm_public_ip.public_ip.id}"
    }
  
    tags = "${
      merge(map("Name", format("%s %s %s",var.env_name,var.azure_instance_names, "Public_IP_Interface")),var.global_tags, var.vpc_tags)}"
  }
  </code></pre>
  
  <p>And vm code:</p>
  
  <pre><code>resource "azurerm_virtual_machine" "one_volume" {
  
    count = "${var.single_volume &gt; 0 ? 1 : 0}"
    provider                         = "azurerm.base"
    name                             = "VM_${var.env_name}_${var.azure_instance_names}"
    location                         = "${module.azure_vnet_dtap.resource_group_location}"
    resource_group_name              = "${module.azure_vnet_dtap.resource_group_name}"
    availability_set_id              = "${azurerm_availability_set.availability_set.id}"  
    network_interface_ids            = ["${var.enable_public_ip ? element(concat(azurerm_network_interface.public_ip.*.id,list("")),0) : element(concat(azurerm_network_interface.no_public_ip.*.id,list("")),0)}"]
    vm_size                          = "${var.vm_size}"
    delete_os_disk_on_termination    = "true"
    delete_data_disks_on_termination = "true"
  </code></pre>
  
  <p>All above works fine</p>
  
  <p>Now, i changed output to get rid of Azure subscription</p>
  
  <pre><code>output "subnets_id_wan" {
  
    value = "${slice(split("/",join(",",azurerm_subnet.wan.*.id)), length(split("/",join(",",azurerm_subnet.wan.*.id)))-1, length(split("/",join(",",azurerm_subnet.wan.*.id))))}"
    depends_on = [
      "azurerm_subnet.wan",
    ]
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>security_groups_id_wan = [
     DF-DTAP-WAN-Subnet-Security-Group
  ]
  </code></pre>
  
  <p>when running terraform apply getting:</p>
  
  <pre><code>* module.azure_vm.azurerm_virtual_machine.one_volume: 1 error(s) occurred:
  
  * module.azure_vm.azurerm_virtual_machine.one_volume: Resource 'azurerm_network_interface.public_ip' does not have attribute 'id' for variable 'azurerm_network_interface.public_ip.*.id'
  </code></pre>
  
  <p>tried this as a test:</p>
  
  <pre><code>network_interface_ids            = ["${element(azurerm_network_interface.public_ip.*.id,count.index)}"]
  </code></pre>
  
  <p>but same error, if not using slice in output all works fine</p>