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

Ec2_vpc_routetable : Could not set 'present' on ensure: no implicit conversion of Symbol into String #528

Open vindevoy opened 5 years ago

vindevoy commented 5 years ago

When creating a routetable, I get the following error in the log file. However, the routetable is created without any problem. This happens only when the routetable is created. When running the script again, I have no error in the logs at all.

2019-04-17 15:24:15 +0200 /Stage[main]/Kickstartervpc::Vpc/Ec2_vpc_routetable[dap-kx-public]/ensure (err): change from 'absent' to 'present' failed: Could not set 'present' on ensure: no implicit conversion of Symbol into String (... vpc.pp, line: 28)

FULL CODE of this vpc.pp

include settings::params

class kickstartervpc::vpc (

$_region = $settings::params::aws_region, $_cidr = $settings::params::vpc_cidr, $_name = $settings::params::vpc_name,

$_rt_name = join([$_name, "-public"])

) { ec2_vpc { $_name: ensure => present, region => $_region, cidr_block => $_cidr, tags => { join (["kubernetes.io/cluster/", $_name]) => "shared" } } -> exec { "rename_default_route_table": path => "/usr/local/bin:/usr/bin:/bin", command => join(["aws ec2 describe-route-tables --filter Name=tag:Name,Values=", $_name, " --query='RouteTables[0].RouteTableId' --output text | ", "xargs aws ec2 create-tags --tags Key=Name,Value=", $_name, "-private --resources "]), onlyif => join(["test aws ec2 describe-route-tables --filter Name=tag:Name,Values=", $_name, " --query='RouteTables[0].RouteTableId' --output text | grep -v 'None' | wc -l -gt 0"]) } -> ec2_vpc_routetable { $_rt_name: ensure => present, vpc => $_name, region => $_region,
tags => { 'Name' => $_rt_name } } }

I have tried with the 'present' as String also, but that does not really help (see sample of another bug report below)

ec2_vpc_routetable { 'test-id-vpc-routetable': ensure => 'present'

I'm running this on a Mac, with puppet and all installed using brew. I run "puppet apply myModuleName"