Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

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

Open
vindevoy opened this issue Apr 17, 2019 · 0 comments

Comments

@vindevoy
Copy link

vindevoy commented Apr 17, 2019

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"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant