puppetlabs-aws
puppetlabs-aws copied to clipboard
ec2_launchconfiguration fails to parse block devices
We are running into issue when creation of launch configurations using ec2_launchconfiguration fails if there is an existing launch configuration that was created from AWS console (probably also using CLI or other means).
The error message is related to block devices:
Error: Could not run: Puppet detected a problem with the information returned from AWS when looking up ec2_launchconfiguration in eu-west-1. The specific error was: undefined method 'volume_size' for nil:NilClass
If I describe launch configuration using AWS cli I can see that ephemeral devices and additional devices that are not mapped are part of the response which is probably causing the error since we expect volume_size to be always present:
"BlockDeviceMappings": [ { "DeviceName": "/dev/sdc", "VirtualName": "ephemeral1" }, { "DeviceName": "/dev/sdb", "VirtualName": "ephemeral0" }, { "DeviceName": "/dev/sdd", "NoDevice": true }, { "DeviceName": "/dev/sda1", "Ebs": { "DeleteOnTermination": false, "VolumeSize": 50, "VolumeType": "gp2" } }, { "DeviceName": "/dev/sde", "NoDevice": true } ],
It seems to be introduced by this commit: https://github.com/puppetlabs/puppetlabs-aws/commit/0e1707297c8da55ce0bc54d6595fb080e882199d @benpillet
Having the same problem.
Debug: Prefetching v2 resources for ec2_launchconfiguration Debug: mapping: #<struct Aws::AutoScaling::Types::BlockDeviceMapping virtual_name="ephemeral1", device_name="/dev/sdc", ebs=nil, no_device=nil>
/dev/sdc is coming from a previously created launch configuration using a c3.large instance type. So basically when it loops through the launch configurations it's trying to convert them to a hash (self.config_to_hash) but can't if you have a launch configuration that uses an instance type with ephemeral storage.
This renders this module useless for all launch configurations if any old launch configuration uses ephemeral storage.