sous-chefs / aws

Development repository for the aws cookbook
https://supermarket.chef.io/cookbooks/aws
Apache License 2.0
608 stars 553 forks source link

aws_ebs_volume fails to create volume on OpsWorks instance #395

Closed edeati closed 5 years ago

edeati commented 5 years ago

Cookbook version

8.0.4

Chef-client version

12.13.37

Platform Details

Amazon Linux 2017.03

Scenario:

Trying to create an EBS volume

Steps to Reproduce:

Create a new instance in OpsWorks and use the following code in your custom cookbooks

aws_ebs_volume 'data-vol' do
  size 50
  device '/dev/sdl'
  volume_type 'gp2'
  delete_on_termination true
  action [:create, :attach]
end

Expected Result:

50G volume is created on the OpsWorks instance

Actual Result:

As of today 24/10/2019 and error is thrown in OpsWorks and volume is not created

...
[2019-10-24T04:32:13+00:00] INFO: Processing aws_ebs_volume[data-vol] action create (opsworks_volume::default line 10)
[2019-10-24T04:32:13+00:00] DEBUG: Initializing the EC2 Client
[2019-10-24T04:32:13+00:00] DEBUG: Using region ap-southeast-2 from Ohai attributes
[2019-10-24T04:32:13+00:00] DEBUG: Using local credential chain
[2019-10-24T04:32:13+00:00] DEBUG: Initializing interface with client interface options: {:region=>"ap-southeast-2", :http_proxy=>nil}

================================================================================
Error executing action `create` on resource 'aws_ebs_volume[data-vol]'
================================================================================

ArgumentError
-------------
wrong number of arguments (given 3, expected 2)

Cookbook Trace:
---------------
/var/chef/runs/772b9dd4-8242-4542-85b8-55c3801e3ad1/local-mode-cache/cache/cookbooks/aws/libraries/ec2.rb:97:in `create_aws_interface'
/var/chef/runs/772b9dd4-8242-4542-85b8-55c3801e3ad1/local-mode-cache/cache/cookbooks/aws/libraries/ec2.rb:25:in `ec2'
/var/chef/runs/772b9dd4-8242-4542-85b8-55c3801e3ad1/local-mode-cache/cache/cookbooks/aws/resources/ebs_volume.rb:178:in `currently_attached_volume'
/var/chef/runs/772b9dd4-8242-4542-85b8-55c3801e3ad1/local-mode-cache/cache/cookbooks/aws/resources/ebs_volume.rb:43:in `block in class_from_file'

Resource Declaration:
---------------------
# In /var/chef/runs/772b9dd4-8242-4542-85b8-55c3801e3ad1/local-mode-cache/cache/cookbooks/opsworks_volume/recipes/default.rb

 10: aws_ebs_volume 'data-vol' do
 11:   size 50
 12:   device '/dev/sdl'
 13:   volume_type 'gp2'
 14:   delete_on_termination true
 15:   action [:create, :attach]
 16: end
 17: 

Compiled Resource:
------------------
# Declared in /var/chef/runs/772b9dd4-8242-4542-85b8-55c3801e3ad1/local-mode-cache/cache/cookbooks/opsworks_volume/recipes/default.rb:10:in `from_file'

aws_ebs_volume("data-vol") do
  action [:create, :attach]
  retries 0
  retry_delay 2
  default_guard_interpreter :default
  declared_type :aws_ebs_volume
  cookbook_name "opsworks_volume"
  recipe_name "default"
  size 50
  device "/dev/sdl"
  volume_type "gp2"
  delete_on_termination true
  region "ap-southeast-2"
end

Platform:
---------
x86_64-linux

[2019-10-24T04:32:13+00:00] INFO: Running queued delayed notifications before re-raising exception
[2019-10-24T04:32:13+00:00] DEBUG: Re-raising exception: ArgumentError - aws_ebs_volume[data-vol] (opsworks_volume::default line 10) had an error: ArgumentError: wrong number of arguments (given 3, expected 2)
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-partitions-1.162.0/lib/aws-partitions/endpoint_provider.rb:94:in `resolve'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/aws-sdk-core/plugins/regional_endpoint.rb:39:in `block in <class:RegionalEndpoint>'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:70:in `call'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:213:in `block in resolve_defaults'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:57:in `each'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:57:in `each'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:212:in `resolve_defaults'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:205:in `value_at'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:189:in `block in resolve'
  /opt/chef/embedded/lib/ruby/2.3.0/set.rb:306:in `each_key'
  /opt/chef/embedded/lib/ruby/2.3.0/set.rb:306:in `each'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:189:in `resolve'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:177:in `apply_defaults'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:150:in `build!'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/base.rb:62:in `build_config'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/base.rb:19:in `initialize'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-ec2-1.84.0/lib/aws-sdk-ec2/client.rb:252:in `initialize'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/base.rb:99:in `new'
  /var/chef/runs/772b9dd4-8242-4542-85b8-55c3801e3ad1/local-mode-cache/cache/cookbooks/aws/libraries/ec2.rb:97:in `create_aws_interface'
  /var/chef/runs/772b9dd4-8242-4542-85b8-55c3801e3ad1/local-mode-cache/cache/cookbooks/aws/libraries/ec2.rb:25:in `ec2'
  /var/chef/runs/772b9dd4-8242-4542-85b8-55c3801e3ad1/local-mode-cache/cache/cookbooks/aws/resources/ebs_volume.rb:178:in `currently_attached_volume'
  /var/chef/runs/772b9dd4-8242-4542-85b8-55c3801e3ad1/local-mode-cache/cache/cookbooks/aws/resources/ebs_volume.rb:43:in `block in class_from_file'
  (eval):2:in `block in action_create'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider.rb:361:in `instance_eval'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider.rb:361:in `compile_and_converge_action'
  (eval):2:in `action_create'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider.rb:145:in `run_action'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/resource.rb:622:in `run_action'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/runner.rb:69:in `run_action'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/runner.rb:97:in `block (2 levels) in converge'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/runner.rb:97:in `each'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/runner.rb:97:in `block in converge'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/resource_collection/stepable_iterator.rb:114:in `call_iterator_block'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/resource_collection/stepable_iterator.rb:103:in `iterate'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/runner.rb:96:in `converge'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/client.rb:670:in `block in converge'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/client.rb:665:in `catch'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/client.rb:665:in `converge'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/client.rb:704:in `converge_and_save'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/client.rb:284:in `run'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application.rb:295:in `block in fork_chef_client'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application.rb:283:in `fork'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application.rb:283:in `fork_chef_client'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application.rb:248:in `block in run_chef_client'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/local_mode.rb:44:in `with_server_connectivity'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application.rb:236:in `run_chef_client'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application/client.rb:464:in `sleep_then_run_chef_client'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application/client.rb:451:in `block in interval_run_chef_client'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application/client.rb:450:in `loop'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application/client.rb:450:in `interval_run_chef_client'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application/client.rb:434:in `run_application'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application.rb:59:in `run'
  /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/bin/chef-client:26:in `<top (required)>'
  /opt/chef/bin/chef-client:57:in `load'
  /opt/chef/bin/chef-client:57:in `<main>'

Earlier in the run logs I see Using aws-sdk-core 3.52.1 is resolved as dependency but the instance also has 3.71.0 and looks like that's being used during the run of the cookbooks.

welcomebot commented 5 years ago

Hey There It looks like this is the first issue you've filed against the chef-cookbooks project. I'm here to offer you a bit of extra help to make sure we can quickly get back to you. Make sure you've filled out all the fields in our issue template. Make sure you've provided us with the version of chef-client you're running, your operating system and the version of the cookbook. If you're not using the most up to date version of the cookbook then please make sure to update first. Lots of things change between versions even if you're issue isn't listed in the changelog. Finally please give us a detailed description of the issue you're having. The more we know about what you're trying to do, what actually happens, and how you can reproduce the problem, the better.

If you're looking for more immediate troubleshooting help make sure to check out #general on the Chef Community Slack. There's plenty of folks there willing to lend a helping hand. Thanks for the first issue. We hope we can get back to you soon with a solution.

edeati commented 5 years ago

Please close this bug. It was caused by wrong aws-partitions dependency set on the release 3.71.0 of aws-sdk-core so it's an aws-sdk-core issue.

aws-sdk-core 3.72.0 fixes this issue: https://github.com/aws/aws-sdk-ruby/blob/master/gems/aws-sdk-core/CHANGELOG.md

There is still an issue with wrong versions of aws-sdk-core being used if you have an aws-sdk dependency in your cookbooks.