Contributors30 minutesTest Kitchen enables you to specify details about your virtual machine. When working with Google Cloud Platform, this includes which image to use, the instance size, networking settings, and how to run Chef – including which recipes and which tests to run. Test Kitchen is the interface you use to create, destroy, and run Chef on your instances.
Here you'll make sure that your workstation is set up for Chef development. You'll also prepare your Google account to create test instances.
Log in to your Google Cloud Platform account. If you don't have an account, Google is offering a 60-day free trial for up to $300 (USD) of usage.
| In this module you'll use CentOS, a free computing platform that's functionally compatible with Red Hat Enterprise Linux. CentOS typically costs less to run on Google Cloud Platform, and is an ideal way to quickly test out your Chef code. |
1. Set up your workstation for Chef development
Although this module doesn't involve the Chef server or bootstrapping a node, we recommend that you complete Manage a Red Hat Enterprise Linux node with Chef server before starting this module.
If you prefer to learn about local development now, before learning how to bootstrap a node, perform these steps to set up your workstation. Then come back to this page.
At this point, your workstation should:
- have the latest version of Chef Workstation.
- have a programmer's text editor that you're comfortable working with.
- have the
~/learn-chef directory for you to work in. - have Git and an SSH client.
Having Git is important because you'll use it to download starter code to work with.
Having an SSH client is important because you can use it to log in to your CentOS instance to verify your work.
If your workstation is running Windows, remember to open the Chef Workstation desktop shortcut. The desktop shortcut brings up a PowerShell session that's configured to work with Chef.

2. Prepare your Google account
You'll use Test Kitchen to create a Google Compute Engine instance later in this module. For now, let's ensure you have everything you'll need to create and connect to your instance.
Test Kitchen uses drivers, or plugins, to work with cloud and virtualization platforms. Some drivers come with Chef Workstation. For Google Compute Engine, you need to install the kitchen-google driver on your workstation manually. You also need to create a configuration file on your workstation that authenticates access to Google Compute Engine resources.
Review the kitchen-google project page and perform the steps to install the driver and set your configuration file. Here are the important points to keep in mind.
- Ensure you have access to a Google Cloud Platform project and note its name for later. An example project name is "funky-penguin-12345".
- Ensure you have a credentials file to enable Test Kitchen to authenticate commands. An example credentials file looks like this.
Editor: ~/.config/gcloud/application_default_credentials.json
1
2
3
4
5
6
| {
"client_id": "54525506288.apps.googleusercontent.com",
"client_secret": "msJ39g2yerjDjyT33lZH8NC2",
"refresh_token": "1/tm5xAD7g77HpCGUmLeExnS4XjOkVWOfUSlTK_CH6Rzz",
"type": "authorized_user"
} |
- Ensure you have an SSH keypair to enable Test Kitchen to connect to your instances. You provide the public part of the key pair as metadata for your project; the private part stays with you. Here's an example from the Compute Engine console.

- Here's an example of how to install the
kitchen-google driver.
Terminal: ~
$ | chef gem install kitchen-googleSuccessfully installed uber-0.0.15Successfully installed representable-2.3.0Successfully installed retriable-2.1.0Successfully installed hurley-0.2Successfully installed google-api-client-0.9.28Successfully installed gcewinpass-1.0.0Successfully installed kitchen-google-1.4.07 gems installed
|
Also note the zone, for example, us-east1-c, where you'll run your test instances.
If you're new to Google Cloud Platform, Google's Quickstart Using a Linux VM module walks you through the creation of your first Linux virtual machine. After you verify that you're able to create an instance, note the zone for later.