$dirs = ["/tmp/foo", "/tmp/bar", "/tmp/baz"]

file { $dirs:
ensure => directory
}

#I don't know if this would get what you want

file { "${dirs}/test.txt":
ensure => present,
content => "test\n"
}