{"action":"created","issue":{"url":"https://api.github.com/repos/chef/chef-provisioning-aws/issues/139","labels_url":"https://api.github.com/repos/chef/chef-provisioning-aws/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/chef/chef-provisioning-aws/issues/139/comments","events_url":"https://api.github.com/repos/chef/chef-provisioning-aws/issues/139/events","html_url":"https://github.com/chef/chef-provisioning-aws/issues/139","id":63084693,"number":139,"title":"`aws_dhcp_options` not able to be referenced by `aws_vpc` resource","user":{"login":"dblessing","id":2394772,"avatar_url":"https://avatars.githubusercontent.com/u/2394772?v=3","gravatar_id":"","url":"https://api.github.com/users/dblessing","html_url":"https://github.com/dblessing","followers_url":"https://api.github.com/users/dblessing/followers","following_url":"https://api.github.com/users/dblessing/following{/other_user}","gists_url":"https://api.github.com/users/dblessing/gists{/gist_id}","starred_url":"https://api.github.com/users/dblessing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dblessing/subscriptions","organizations_url":"https://api.github.com/users/dblessing/orgs","repos_url":"https://api.github.com/users/dblessing/repos","events_url":"https://api.github.com/users/dblessing/events{/privacy}","received_events_url":"https://api.github.com/users/dblessing/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-19T20:27:23Z","updated_at":"2015-03-24T21:23:41Z","closed_at":"2015-03-24T21:23:41Z","body":"When specifying `aws_dhcp_options` as a resource and attempting to reference in `aws_vpc`, chef run gives error that the dhcp_options set does not exist. Since `aws_dhcp_options` is first in the recipe, it should be created and be able to be referenced by `aws_vpc`.\r\n\r\nRecipe:\r\n```\r\nrequire 'chef/provisioning/aws_driver'\r\nwith_driver 'aws::us-east-1'\r\n\r\naws_dhcp_options 'default' do\r\n  domain_name_servers [ 'AmazonProvidedDNS' ]\r\nend\r\n\r\naws_vpc 'NorthVirginia' do\r\n  cidr_block '10.1.0.0/16'\r\n  enable_dns_support true\r\n  enable_dns_hostnames true\r\n  instance_tenancy :default\r\n  internet_gateway true\r\n  dhcp_options 'default'\r\nend\r\n```\r\n\r\nError:\r\n```\r\n ================================================================================\r\n           Error executing action `create` on resource 'aws_vpc[NorthVirginia]'\r\n           ================================================================================\r\n\r\n           RuntimeError\r\n           ------------\r\n           Chef::Resource::AwsDhcpOptions[default] does not exist!\r\n\r\n           Resource Declaration:\r\n           ---------------------\r\n           # In /tmp/kitchen/cache/cookbooks/my_aws/recipes/vpc.rb\r\n\r\n            15: aws_vpc 'NorthVirginia' do\r\n            16:   vpc_id 'removed'\r\n            17:   cidr_block '10.1.0.0/16'\r\n            18:   enable_dns_support true\r\n            19:   enable_dns_hostnames true\r\n            20:   instance_tenancy :default\r\n            21:   internet_gateway 'removed'\r\n            22:   dhcp_options 'default'\r\n            23: end\r\n\r\n           Compiled Resource:\r\n           ------------------\r\n           # Declared in /tmp/kitchen/cache/cookbooks/bke_aws/recipes/vpc.rb:15:in `from_file'\r\n\r\n           aws_vpc(\"NorthVirginia\") do\r\n             action :create\r\n             retries 0\r\n             retry_delay 2\r\n             default_guard_interpreter :default\r\n             driver #<Chef::Provisioning::AWSDriver::Driver:0x0000000b247da8 @driver_url=\"aws::us-east-1\", @config={:node_name=>\"default-centos-66\", :checksum_path=>\"/tmp/kitchen/checksums\", :file_cache_path=>\"/tmp/kitchen/cache\", :file_backup_path=>\"/tmp/kitchen/backup\", :cookbook_path=>\"/tmp/kitchen/cache/cookbooks\", :data_bag_path=>\"/tmp/kitchen/data_bags\", :environment_path=>\"/tmp/kitchen/environments\", :node_path=>\"/tmp/kitchen/nodes\", :role_path=>\"/tmp/kitchen/roles\", :client_path=>\"/tmp/kitchen/clients\", :user_path=>\"/tmp/kitchen/users\", :validation_key=>\"/tmp/kitchen/validation.pem\", :client_key=>\"/tmp/kitchen/client.pem\", :chef_server_url=>\"http://localhost:8889\", :encrypted_data_bag_secret=>\"/tmp/kitchen/encrypted_data_bag_secret\", :force_logger=>false, :force_formatter=>true, :color=>false, :local_mode=>true, :config_file=>\"/tmp/kitchen/client.rb\", :log_level=>:auto, :chef_zero_port=>\"8889\", :json_attribs=>\"/tmp/kitchen/dna.json\", :log_location=>#<IO:<STDOUT>>, :specific_recipes=>[], :repo_mode=>\"everything\", :formatters=>[], :event_handlers=>[], :authentication_protocol_version=>\"1.0\", :start_handlers=>[], :internal_locale=>\"en_US.UTF-8\", :user_valid_regex=>[/^[^-+~:,\\t\\r\\n\\f\\0]+[^:,\\t\\r\\n\\f\\0]*$/], :group_valid_regex=>[/^[^-+~:,\\t\\r\\n\\f\\0]+[^:,\\t\\r\\n\\f\\0]*$/]}, @aws_credentials=#<Chef::Provisioning::AWSDriver::Credentials:0x0000000b247ba0 \r\n             chef_server {:chef_server_url=>\"http://localhost:8889\", :options=>{:client_name=>\"default-centos-66\", :signing_key_filename=>\"/tmp/kitchen/client.pem\"}}\r\n             declared_type :aws_vpc\r\n             cookbook_name \"my_aws\"\r\n             recipe_name \"vpc\"\r\n             vpc_id \"removed\"\r\n             cidr_block \"10.1.0.0/16\"\r\n             enable_dns_support true\r\n             enable_dns_hostnames true\r\n             instance_tenancy :default\r\n             internet_gateway \"removed\"\r\n             dhcp_options \"default\"\r\n           end\r\n\r\n       [2015-03-19T20:23:26+00:00] ERROR: Converge failed with error message aws_vpc[NorthVirginia] (my_aws::vpc line 15) had an error: RuntimeError: Chef::Resource::AwsDhcpOptions[default] does not exist!\r\n\r\n       Running handlers:\r\n       [2015-03-19T20:23:26+00:00] ERROR: Running exception handlers\r\n       Running handlers complete\r\n       [2015-03-19T20:23:26+00:00] ERROR: Exception handlers complete\r\n       [2015-03-19T20:23:26+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out\r\n       Chef Client failed. 0 resources updated in 9.591803241 seconds\r\n       [2015-03-19T20:23:26+00:00] ERROR: Found 1 errors, they are stored in the backtrace\r\n       [2015-03-19T20:23:28+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)\r\n>>>>>> Converge failed on instance <default-centos-66>.\r\n>>>>>> Please see .kitchen/logs/default-centos-66.log for more details\r\n>>>>>> ------Exception-------\r\n>>>>>> Class: Kitchen::ActionFailed\r\n>>>>>> Message: SSH exited (1) for command: [sh -c '\r\nsudo -E /opt/chef/bin/chef-client --local-mode --config /tmp/kitchen/client.rb --log_level auto --force-formatter --no-color --chef-zero-port 8889 --json-attributes /tmp/kitchen/dna.json\r\n']\r\n>>>>>> ----------------------\r\n```"},"comment":{"url":"https://api.github.com/repos/chef/chef-provisioning-aws/issues/comments/85697539","html_url":"https://github.com/chef/chef-provisioning-aws/issues/139#issuecomment-85697539","issue_url":"https://api.github.com/repos/chef/chef-provisioning-aws/issues/139","id":85697539,"user":{"login":"dblessing","id":2394772,"avatar_url":"https://avatars.githubusercontent.com/u/2394772?v=3","gravatar_id":"","url":"https://api.github.com/users/dblessing","html_url":"https://github.com/dblessing","followers_url":"https://api.github.com/users/dblessing/followers","following_url":"https://api.github.com/users/dblessing/following{/other_user}","gists_url":"https://api.github.com/users/dblessing/gists{/gist_id}","starred_url":"https://api.github.com/users/dblessing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dblessing/subscriptions","organizations_url":"https://api.github.com/users/dblessing/orgs","repos_url":"https://api.github.com/users/dblessing/repos","events_url":"https://api.github.com/users/dblessing/events{/privacy}","received_events_url":"https://api.github.com/users/dblessing/received_events","type":"User","site_admin":false},"created_at":"2015-03-24T21:23:40Z","updated_at":"2015-03-24T21:23:40Z","body":"This appears to be fixed in `jk/create_update_delete`."}}