# profiles::haproxy::backends class profiles::haproxy::backends { # set location_environment $location_environment = "${facts['country']}-${facts['region']}-${facts['environment']}" # for each backend: $backends = lookup('profiles::haproxy::backends', Hash, 'deep', {}) $backends.each |$backend, $data| { # create backend haproxy::backend { $backend: * => $data, } # collect exported resources $tag = "${backend}_${location_environment}" Haproxy::Balancermember <<| tag == $tag |>> } }