Loop list of map variable to the resource

variable "details" {
  description = "details"
  default = [
      details_name               = "name"
     details_filesystem_name    = ["test1", "test2"]
      details_filesystem_path_name = {
        "test1"  = ["path1", "path2"]
        "test2" = ["path3", "path4"]

I should be able to create 8 resources.

I am able to create example1 resource

resource "example1" "default1" {
  for_each =  { for idx, details in var.details : idx => details } : {}

When I ran the plan on the example2 resource I had an issue

 account.details_filesystem_name is a tuple with 2 elements
│ Cannot include the given value in a string template: string required.
resource "example2" "default2" {
  for_each           = { for idx, account in var.details  : idx => account.details_filesystem_name  }
  name               =  each.value

the same thing goes for details_filesystem_path_name. how to overcome the issue

To me it looks like this example data only accounts for 7 resources, maximum. Please explain in more detail.

This construction is unwise - if the entries in var.details change in order, for example by new ones being added/removed other than at the end of the list, there will be undesired reshuffling of existing items to different indexes, causing Terraform to perform undesired changes.

You should restructure the input data to be a map keyed on name. Whilst you’re doing that, you might as well also resolve the redundancy in listing the filesystem_names twice:

variable "details" {
  default = {
    name = {
      test1 = ["path1", "path2"]
      test2 = ["path3", "path4"]

You have apparently attempted to use account.details_filesystem_name inside a string template, but you have not shown that code! You do need to show the code you want help with fixing.