title: Failing To Find Chef Community Cookbooks Using Chef 12 On AWS Opsworks
body: <h2>The Problem</h2>
  <p>When running custom cookbooks on AWS OpsWorks a <code>setup_failed</code> status appears against the instance and the following in the failure log:</p>
  <pre><code>[2016-03-26T22:53:48+00:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /var/chef
  One version per cookbook
  data_bags at /var/chef/runs/62832572-cb67-421a-8309-d831140d7b98/data_bags
  nodes at /var/chef/runs/62832572-cb67-421a-8309-d831140d7b98/nodes
   
  [2016-03-26T22:53:48+00:00] INFO: Forking chef instance to converge...
  [2016-03-26T22:53:48+00:00] INFO: *** Chef 12.7.2 ***
  [2016-03-26T22:53:48+00:00] INFO: Chef-client pid: 17842
  [2016-03-26T22:53:49+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: chefzero://localhost:8889/nodes/test1.localdomain
  [2016-03-26T22:53:49+00:00] INFO: Setting the run_list to [&quot;recipe[my_cookbook::default]&quot;] from CLI options
  [2016-03-26T22:53:49+00:00] INFO: Run List is [recipe[my_cookbook::default]]
  [2016-03-26T22:53:49+00:00] INFO: Run List expands to [my_cookbook::default]
  [2016-03-26T22:53:49+00:00] INFO: Starting Chef Run for test1.localdomain
  [2016-03-26T22:53:49+00:00] INFO: Running start handlers
  [2016-03-26T22:53:49+00:00] INFO: Start handlers complete.
  [2016-03-26T22:53:49+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: 
  [2016-03-26T22:53:49+00:00] INFO: HTTP Request Returned 412 Precondition Failed: No such cookbook: apt
   
  ================================================================================
  Error Resolving Cookbooks for Run List:
  ================================================================================
   
  Missing Cookbooks:
  ------------------
  No such cookbook: apt
   
  Expanded Run List:
  ------------------
  * my_cookbook::default
  </code></pre>
  <hr />
  <h2>The OpsWorks stack is configured</h2>
  <ul>
  <li>for Chef 12</li>
  <li>to use custom Chef cookbooks</li>
  <li>to use a Git repository for the custom cookbooks</li>
  </ul>
  <h2>The Custom Cookbook Repo</h2>
  <p>For the sake of finding the cause of the problem, a cookbook was created with a single recipe that runs <code>apt-get update</code> (which runs as expected under <code>kitchen converge</code>). The files were created using <code>chef generate cookbook my_cookbook</code>:</p>
  <pre><code>.
  └── my_cookbook
      ├── Berksfile
      ├── chefignore
      ├── metadata.rb
      ├── README.md
      ├── recipes
      │   └── default.rb
      ├── spec
      │   ├── spec_helper.rb
      │   └── unit
      │       └── recipes
      │           └── default_spec.rb
      └── test
          └── integration
              ├── default
              │   └── serverspec
              │       └── default_spec.rb
              └── helpers
                  └── serverspec
                      └── spec_helper.rb
  </code></pre>
  <h3>The only altered files are:</h3>
  <p>my_cookbook/Berksfile</p>
  <pre><code>source 'https://supermarket.chef.io'    
  metadata    
  cookbook 'apt'
  </code></pre>
  <p>my_cookbook/metadata.rb</p>
  <pre><code>...
  depends 'apt', '~&gt; 3.0.0'
  </code></pre>
  <p>my_cookbook/recipes/default.rb</p>
  <pre><code>include_recipe 'apt::default'
  </code></pre>
  <p>Also, a Berksfile was added to the root of the repo</p>
  <pre><code>source 'https://supermarket.chef.io'
  cookbook 'apt'
  </code></pre>
  <hr />
  <h2>The  Current Workaround</h2>
  <p>The current workaround involves downloading the dependencies using <code>berks vendor</code> and then copying the downloaded cookbooks into the root of the repo ie:</p>
  <pre><code>.
  ├── Berksfile
  ├── apt
  └── my_cookbook
  </code></pre>
  <p>Is there a better solution (using AWS OpsWorks with Chef 12) that does not require explicitly storing and distributing community cookbooks with custom cookbooks?</p>