puppetlabs-toy-chest / puppetlabs-aws

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

ec2_vpc throws strange errors if region parameter is absent #484

Open aptituz opened 6 years ago

aptituz commented 6 years ago

When defining anec2_vpc resource and not specifying the region parameter the module throws strange error messages like "Could not set 'present' on ensure: type mismatch: String given".

The problem can be reproduced with a manifest like the following:

ec2_vpc { 'foo':
  ensure      => present,
  cidr_block => '10.0.0.0/24',
}

I had AWS_REGIONdefined in my environment and would have assumed that the module uses that instead of specifying it in each resource, but apparently it isn't as the debug output tells:

Info: Creating VPC foo in absent

Setting a region in the resource is a viable workaround, but if the region argument is required the error handling should be adjusted to actually say so.

This happened with version 2.0.0 of the module and puppet 4.10.8.