puppetlabs-aws icon indicating copy to clipboard operation
puppetlabs-aws copied to clipboard

ec2_vpc throws strange errors if region parameter is absent

Open aptituz opened this issue 6 years ago • 0 comments

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.

aptituz avatar Nov 05 '17 14:11 aptituz