chef-boneyard / chef-provisioning-aws

AWS driver and resources for Chef that uses the AWS SDK
Apache License 2.0
142 stars 121 forks source link

Error: undefined method `gateway_id' for nil:NilClass #511

Open r4hulgupta opened 8 years ago

r4hulgupta commented 8 years ago

I get the below error when I try to run the recipe on an existing AWS VPC which was deployed using Chef. It happens when I try to run it the second time to update some changes. I tried to google it but can't find a thing. Please Help! Code for Route table resource:

aws_route_table "#{Rtb_STZ_Name}" do
  vpc "#{VPC_Name}"
  routes "#{Infra_VPC_IP}" => {vpc_peering_connection: "#{Infra_Peer_Name}"}
  aws_tags 'CustomerName' => "#{Customer_Name}", 'TenantId' => "#{Tenant_ID}", 'Name' => "#{Rtb_STZ_Name}"
end

Chef Stacktrace Output:

Generated at 2016-11-07 02:58:30 +0000
NoMethodError: aws_route_table[EG5993_STZ_21.38_RT_01] (rtb-e0279987) (network_stack::network_stack line 224) had an error: NoMethodError: undefined method `gateway_id' for nil:NilClass
C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-provisioning-aws-2.0.0/lib/chef/provider/aws_route_table.rb:75:in `block in update_routes'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/aws-sdk-resources-2.6.18/lib/aws-sdk-resources/batch.rb:75:in `each'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/aws-sdk-resources-2.6.18/lib/aws-sdk-resources/batch.rb:75:in `each'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/aws-sdk-resources-2.6.18/lib/aws-sdk-resources/batch.rb:75:in `each'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-provisioning-aws-2.0.0/lib/chef/provider/aws_route_table.rb:73:in `update_routes'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-provisioning-aws-2.0.0/lib/chef/provider/aws_route_table.rb:13:in `action_create'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/provider.rb:145:in `run_action'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/resource.rb:603:in `run_action'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/runner.rb:69:in `run_action'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/runner.rb:97:in `block (2 levels) in converge'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/runner.rb:97:in `each'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/runner.rb:97:in `block in converge'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:114:in `call_iterator_block'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:103:in `iterate'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/runner.rb:96:in `converge'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/client.rb:669:in `block in converge'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/client.rb:664:in `catch'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/client.rb:664:in `converge'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/client.rb:703:in `converge_and_save'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/client.rb:283:in `run'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/application.rb:284:in `run_with_graceful_exit_option'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/application.rb:260:in `block in run_chef_client'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/application.rb:243:in `run_chef_client'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/application/client.rb:464:in `sleep_then_run_chef_client'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/application/client.rb:451:in `block in interval_run_chef_client'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/application/client.rb:450:in `loop'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/application/client.rb:450:in `interval_run_chef_client'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/application/client.rb:434:in `run_application'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/lib/chef/application.rb:60:in `run'
C:/Users/rgupta/AppData/Local/chefdk/gem/ruby/2.3.0/gems/chef-12.15.19-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chefdk/bin/chef-client:68:in `load'
C:/opscode/chefdk/bin/chef-client:68:in `<main>'
r4hulgupta commented 8 years ago

Update: It doesn't show the error if I remove vpc_peering_connection containing route...