puppetlabs-toy-chest / puppetlabs-aws

Puppet module for managing AWS resources to build out infrastructure
Apache License 2.0
187 stars 219 forks source link

How to generate security group using inline_template? #503

Open kerbachi opened 6 years ago

kerbachi commented 6 years ago

Hi all,

Trying unsuccessfully to generate a security group using inline_template:

$my_sg={ protocol => 'tcp',
         port     => 22,
         cidr     => '1.1.1.1/32',}
ec2_securitygroup { 'my-security-group':
  ensure      => present,
  region      => 'us-east-1',
  vpc         => 'vpc-puppet',
  description => 'a description here',
  ingress     => [inline_template('<%=@my_sg %>')],
  tags        => {
    tag_name  => 'value',
  },
}

The error is:

vagrant@u16:~$ /opt/puppetlabs/bin/puppet apply puppet-sg.pp --verbose Notice: Compiled catalog for u16.ubuntu.int in environment production in 0.05 seconds Error: Parameter ingress failed on Ec2_securitygroup[my-security-group]: ingress should be a Hash (file: /home/vagrant/puppet-sg.pp, line: 6)

Thanks!