Hi,
Given a machine named “foo”, I am trying to create a new Elastic IP address using the following recipe:
name = “foo"
aws_eip_address “#{name}-eip” do
machine name
action :create
end
I’m getting the following exception and stacktrace:
IPAddr::AddressFamilyError: address family must be specified
/opt/chefdk/embedded/lib/ruby/2.1.0/ipaddr.rb:475:in initialize' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-aws-1.4.1/lib/chef/resource/aws_eip_address.rb:28:in
new’
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-aws-1.4.1/lib/chef/resource/aws_eip_address.rb:28:in block in <class:AwsEipAddress>' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/property.rb:555:in
instance_exec’
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/property.rb:555:in exec_in_resource' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/property.rb:393:in
coerce’
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/property.rb:301:in get' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/property.rb:247:in
call’
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/property.rb:451:in public_ip' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-aws-1.4.1/lib/chef/provisioning/aws_driver/aws_resource_with_entry.rb:113:in
public_send’
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-aws-1.4.1/lib/chef/provisioning/aws_driver/aws_resource_with_entry.rb:113:in should_have_managed_entry?' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-aws-1.4.1/lib/chef/provisioning/aws_driver/aws_resource_with_entry.rb:43:in
get_id_from_managed_entry’
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-aws-1.4.1/lib/chef/provisioning/aws_driver/aws_resource_with_entry.rb:84:in get_driver_and_id' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-aws-1.4.1/lib/chef/provisioning/aws_driver/aws_resource_with_entry.rb:59:in
to_s’
For some reason, coerce on the resource is called with nil as the value, so the code calls IPAddr.new(nil), presumably because I didn’t specify a public_ip attribute. If I specify that, it works, but obviously I don’t want to have to do that - I want the resource to create the elastic IP itself, using the create action.
How is this supposed to work? Is it a bug?
Jos