Hi,
we have the following defined type:
define apache::redir_domains(
$http_port = "80",
$domains = [],){
file{'/etc/httpd/conf.d' :
ensure => 'file',
content => template("apache/redirect_domains.erb"),
}
}
> erb snippit:<%- @domains.each do |domain,value| -%><%- domain.each do |key,val| -%>
ServerAlias <%=val['domain'] %>
RewriteCond %{HTTP_HOST} ^<%=val['domain'] %>
RewriteRule ^(.*)$ <%=val['to'] %>[R=301,L]<%- end -%><%- end -%>
> YAML:domains: - domain: domain: 'www.example.com' to: 'https://www.test.com/example' - domain2: domain: 'example.com' to: 'https://www.test.nl/example'In the default.pp:< create_resources(::apache::redir_domains, hiera_hash('apache::redir_domains')) But we get the following error > " Error: Evaluation Error: Error while evaluating a Function Call, no implicit conversion of Array into Hash" if I use site.pp file and enter the value
domains => [{domain => {domain => 'domain1.com', to => 'wwww.test1.com'}},{domain => {domain=>'domain2.com',to => 'www.test2.com'}}]
it works fine
any help will be appreciated.