Error messages on modules

Error: Incorrect attribute value type

│ on .terraform/modules/virtual-network/main.tf line 8, in resource “azurerm_subnet” “subnet”:
│ 8: name = var.subnet_names
│ ├────────────────
│ │ var.subnet_names is a list of string, known only after apply

│ Inappropriate value for attribute “name”: string required.

Any ideas why this error messages variable is a list string
variable “subnet_names” {
type = list(string)
description = “name of the subnet”
}

Hello eddiefcisneros,

Attribute name in subnet resource has to be assigned a string value not a list of strings.

try this :
name: var.subnet_names[0]
to assign the first element in the list to the name attribute.