file { "/tmp/foobar":
ensure => directory,
before => File["/tmp/foo*/test.txt"]
}

file { "/tmp/foobaz":
ensure => directory,
before => File["/tmp/foo*/test.txt"]
}

file { "/tmp/foo*/test.txt":
ensure => present,
content => "foo\n"
}