${fqdn} not working in puppet manifesto

When using ${fqdn} in your puppet manifestos to specify different config files for your nodes. often they will simply not pick up the correct file. 

  file { "/etc/sysconfig/iptables":
    ensure => "present",
    source => ["puppet:///modules/security/iptables.${fqdn}","puppet:///modules/security/iptables.default"],
    notify  => Service["iptables"], 

The iptables example above always gets the default iptables config file.

To solve this problem, on your puppet host (not the puppet server), run this command. 

[~] # facter --puppet | grep ^fqdn


Either the correct fqdn will come up which you should be using or the fqdn is not set. Workaround is to use the hostname variable or troubleshoot why puppet does not have the fqdn set.

[~] # facter --puppet | grep ^host