Puppet DSL cannot express iteration per se, but it can compactly express a set of resources that differ only in title. In conjunction with defined types, that is usually sufficient for this kind of problem:
define app::thing::conffile ($thingname) {
file { "/opt/app/thing/${thingname}/conf/${name}":
content => template("app/${thingname}/conf_templates/${name}.erb"),
}
}
define app::thing ($config_templates = 'NONE') {
if $config_templates != 'NONE' {
# creates multiple conf files if $config_templates
# is an array:
app::thing::conffile( $config_templates:
thingname => $name
}
}
}
If you need more flexibility than that then you may find the built-in create_resources() function useful to you.
For the ultimate in flexibility, you can always write your manifest in Puppet's Ruby DSL, which more or less makes it a dynamic manifest-generating script instead of an actual manifest. In any case, it lets you use Ruby directly.
John