GoogleCloudPlatform/chef-google-compute

Name: chef-google-compute

Owner: Google Cloud Platform

Description: null

Created: 2017-06-22 19:50:05.0

Updated: 2018-04-23 17:40:39.0

Pushed: 2018-05-23 23:00:03.0

Homepage: null

Size: 416

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Google Compute Engine Chef Cookbook

This cookbook provides the built-in types and services for Chef to manage Google Cloud Compute resources, as native Chef types.

Requirements
Platforms
Supported Operating Systems

This cookbook was tested on the following operating systems:

Example
h_credential 'mycred' do
tion :serviceaccount
th ENV['CRED_PATH'] # e.g. '/path/to/my_account.json'
opes [
'https://www.googleapis.com/auth/compute'



pute_zone 'us-west1-a' do
tion :create
oject 'google.com:graphite-playground'
edential 'mycred'


pute_disk 'instance-test-os-1' do
tion :create
urce_image 'projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts'
ne 'us-west1-a'
oject 'google.com:graphite-playground'
edential 'mycred'


pute_network 'mynetwork-test' do
tion :create
oject 'google.com:graphite-playground'
edential 'mycred'


pute_region 'us-west1' do
tion :create
oject 'google.com:graphite-playground'
edential 'mycred'


pute_address 'instance-test-ip' do
tion :create
gion 'us-west1'
oject 'google.com:graphite-playground'
edential 'mycred'


pute_machine_type 'n1-standard-1' do
tion :create
ne 'us-west1-a'
oject 'google.com:graphite-playground'
edential 'mycred'


pute_instance 'instance-test' do
tion :create
chine_type 'n1-standard-1'
sks [
{
  boot: true,
  auto_delete: true,
  source: 'instance-test-os-1'
}

twork_interfaces [
{
  network: 'mynetwork-test',
  access_configs: [
    {
      name: 'External NAT',
      nat_ip: 'instance-test-ip',
      type: 'ONE_TO_ONE_NAT'
    }
  ]
}

ne 'us-west1-a'
oject 'google.com:graphite-playground'
edential 'mycred'

Credentials

All Google Cloud Platform cookbooks use an unified authentication mechanism, provided by the google-gauth cookbook. Don't worry, it is automatically installed when you install this module.

Example
h_credential 'mycred' do
tion :serviceaccount
th ENV['CRED_PATH'] # e.g. '/path/to/my_account.json'
opes [
'https://www.googleapis.com/auth/compute'


For complete details of the authentication cookbook, visit the google-gauth cookbook documentation.

Resources
gcompute_address

Represents an Address resource.

Each virtual machine instance has an ephemeral internal IP address and, optionally, an external IP address. To communicate between instances on the same network, you can use an instance's internal IP address. To communicate with the Internet and instances outside of the same network, you must specify the instance's external IP address.

Internal IP addresses are ephemeral and only belong to an instance for the lifetime of the instance; if the instance is deleted and recreated, the instance is assigned a new internal IP address, either by Compute Engine or by you. External IP addresses can be either ephemeral or static.

Example
pute_region 'some-region' do
tion :create
label 'us-west1'
oject 'google.com:graphite-playground'
edential 'mycred'


pute_address 'test1' do
tion :create
gion 'some-region'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_address 'id-for-resource' do
dress            string
eation_timestamp time
scription        string
                 integer
me               string
gion             reference to gcompute_region
ers              [
string,
...

oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the a_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_backend_bucket

Backend buckets allow you to use Google Cloud Storage buckets with HTTP(S) load balancing.

An HTTP(S) load balancing can direct traffic to specified URLs to a backend bucket rather than a backend service. It can send requests for static content to a Cloud Storage bucket and requests for dynamic content a virtual machine instance.

Example
* WARNING ***
DO(nelsonjr): http://b/63088154 Google Cloud Platform API is returning
cess denied if we use a more restricted scope such as
tps://www.googleapis.com/auth/compute. For the time being use an all mighty
ope instead: https://www.googleapis.com/auth/cloud-platform.

pute_backend_bucket 'be-bucket-connection' do
tion :create
cket_name 'backend-bucket-test'
scription 'A BackendBucket to connect LNB w/ Storage Bucket'
able_cdn true
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_backend_bucket 'id-for-resource' do
cket_name        string
eation_timestamp time
scription        string
able_cdn         boolean
                 integer
me               string
oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the bb_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_backend_service

Creates a BackendService resource in the specified project using the data included in the request.

Example
ckend Service requires various other services to be setup beforehand. Please
ke sure they are defined as well:
- gcompute_instance_group 'my-masters' do ... end
- Health check
pute_backend_service 'my-app-backend' do
tion :create
ckends [
{ group: 'my-masters' }

able_cdn true
alth_checks [
gcompute_health_check_ref('another-hc', 'google.com:graphite-playground')

oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_backend_service 'id-for-resource' do
finity_cookie_ttl_sec integer
ckends                [
{
  balancing_mode               'UTILIZATION', 'RATE' or 'CONNECTION',
  capacity_scaler              double,
  description                  string,
  group                        reference to gcompute_instance_group,
  max_connections              integer,
  max_connections_per_instance integer,
  max_rate                     integer,
  max_rate_per_instance        double,
  max_utilization              double,
},
...

n_policy              {
cache_key_policy {
  include_host           boolean,
  include_protocol       boolean,
  include_query_string   boolean,
  query_string_blacklist [
    string,
    ...
  ],
  query_string_whitelist [
    string,
    ...
  ],
},

nnection_draining     {
draining_timeout_sec integer,

eation_timestamp      time
scription             string
able_cdn              boolean
alth_checks           [
string,
...

                      integer
me                    string
rt_name               string
otocol                'HTTP', 'HTTPS', 'TCP' or 'SSL'
gion                  reference to gcompute_region
ssion_affinity        'NONE', 'CLIENT_IP', 'GENERATED_COOKIE', 'CLIENT_IP_PROTO' or 'CLIENT_IP_PORT_PROTO'
meout_sec             integer
oject                 string
edential              reference to gauth_credential

Actions Properties Label

Set the bs_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_disk_type

Represents a DiskType resource. A DiskType resource represents the type of disk to use, such as a pd-ssd or pd-standard. To reference a disk type, use the disk type's full or partial URL.

Example
pute_disk_type 'pd-standard' do
tion :create
ne 'us-central1-a'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_disk_type 'id-for-resource' do
eation_timestamp     time
fault_disk_size_gb   integer
precated_deleted     time
precated_deprecated  time
precated_obsolete    time
precated_replacement string
precated_state       'DEPRECATED', 'OBSOLETE' or 'DELETED'
scription            string
                     integer
me                   string
lid_disk_size        string
ne                   reference to gcompute_zone
oject                string
edential             reference to gauth_credential

Actions Properties Label

Set the dt_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_disk

Persistent disks are durable storage devices that function similarly to the physical disks in a desktop or a server. Compute Engine manages the hardware behind these devices to ensure data redundancy and optimize performance for you. Persistent disks are available as either standard hard disk drives (HDD) or solid-state drives (SSD).

Persistent disks are located independently from your virtual machine instances, so you can detach or move persistent disks to keep your data even after you delete your instances. Persistent disk performance scales automatically with size, so you can resize your existing persistent disks or add more persistent disks to an instance to meet your performance and storage space requirements.

Add a persistent disk to your instance when you need reliable and affordable storage with consistent performance characteristics.

Example
pute_disk 'data-disk-1' do
tion :create
ze_gb 50
sk_encryption_key(
raw_key: 'SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0='

ne 'us-central1-a'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_disk 'id-for-resource' do
eation_timestamp             time
scription                    string
sk_encryption_key            {
raw_key string,
sha256  string,

                             integer
st_attach_timestamp          time
st_detach_timestamp          time
censes                       [
string,
...

me                           string
ze_gb                        integer
urce_image                   string
urce_image_encryption_key    {
raw_key string,
sha256  string,

urce_image_id                string
urce_snapshot                string
urce_snapshot_encryption_key {
raw_key string,
sha256  string,

urce_snapshot_id             string
pe                           string
ers                          [
string,
...

ne                           reference to gcompute_zone
oject                        string
edential                     reference to gauth_credential

Actions Properties Label

Set the d_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_firewall

Each network has its own firewall controlling access to and from the instances.

All traffic to instances, even from other instances, is blocked by the firewall unless firewall rules are created to allow it.

The default network has automatically created firewall rules that are shown in default firewall rules. No manually created network has automatically created firewall rules except for a default “allow” rule for outgoing traffic and a default “deny” for incoming traffic. For all networks except the default network, you must create any firewall rules you need.

Example
pute_firewall 'test-fw-allow-ssh' do
tion :create
lowed [
{
  ip_protocol: 'tcp',
  ports: ['22']
}

rget_tags [
'test-ssh-server',
'staging-ssh-server'

oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_firewall 'id-for-resource' do
lowed            [
{
  ip_protocol string,
  ports       [
    string,
    ...
  ],
},
...

eation_timestamp time
scription        string
                 integer
me               string
twork            string
urce_ranges      [
string,
...

urce_tags        [
string,
...

rget_tags        [
string,
...

oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the f_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_forwarding_rule

A ForwardingRule resource. A ForwardingRule resource specifies which pool of target virtual machines to forward a packet to if it matches the given [IPAddress, IPProtocol, portRange] tuple.

Example
pute_forwarding_rule 'fwd-rule-test' do
tion :create
_address gcompute_address_ref(
'some-address',
'us-west1', 'google.com:graphite-playground'

_protocol 'TCP'
rt_range '80'
rget 'target-pool'
gion 'some-region'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_forwarding_rule 'id-for-resource' do
ckend_service       reference to gcompute_backend_service
eation_timestamp    time
scription           string
                    integer
_address            string
_protocol           'TCP', 'UDP', 'ESP', 'AH', 'SCTP' or 'ICMP'
_version            'IPV4' or 'IPV6'
ad_balancing_scheme 'INTERNAL' or 'EXTERNAL'
me                  string
twork               reference to gcompute_network
rt_range            string
rts                 [
string,
...

gion                reference to gcompute_region
bnetwork            reference to gcompute_subnetwork
rget                reference to gcompute_target_pool
oject               string
edential            reference to gauth_credential

Actions Properties Label

Set the fr_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_global_address

Represents a Global Address resource. Global addresses are used for HTTP(S) load balancing.

Example
pute_global_address 'my-app-lb' do
tion :create
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_global_address 'id-for-resource' do
dress            string
eation_timestamp time
scription        string
                 integer
me               string
gion             reference to gcompute_region
oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the ga_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_global_forwarding_rule

Represents a GlobalForwardingRule resource. Global forwarding rules are used to forward traffic to the correct load balancer for HTTP load balancing. Global forwarding rules can only be used for HTTP load balancing.

For more information, see https://cloud.google.com/compute/docs/load-balancing/http/

Example
pute_global_forwarding_rule 'test1' do
tion :create
_address gcompute_global_address_ref(
'my-app-lb-address',
'google.com:graphite-playground'

_protocol 'TCP'
rt_range '80'
rget gcompute_target_http_proxy_ref(
'my-http-proxy',
'google.com:graphite-playground'

oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_global_forwarding_rule 'id-for-resource' do
ckend_service       reference to gcompute_backend_service
eation_timestamp    time
scription           string
                    integer
_address            string
_protocol           'TCP', 'UDP', 'ESP', 'AH', 'SCTP' or 'ICMP'
_version            'IPV4' or 'IPV6'
ad_balancing_scheme 'INTERNAL' or 'EXTERNAL'
me                  string
twork               reference to gcompute_network
rt_range            string
rts                 [
string,
...

gion                reference to gcompute_region
bnetwork            reference to gcompute_subnetwork
rget                string
oject               string
edential            reference to gauth_credential

Actions Properties Label

Set the gfr_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_http_health_check

An HttpHealthCheck resource. This resource defines a template for how individual VMs should be checked for health, via HTTP.

Example
pute_http_health_check 'app-health-check' do
tion :create
c_label 'my-app-http-hc'
althy_threshold 10
rt 8080
meout_sec 2
healthy_threshold 5
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_http_health_check 'id-for-resource' do
eck_interval_sec  integer
eation_timestamp  time
scription         string
althy_threshold   integer
st                string
                  integer
me                string
rt                integer
quest_path        string
meout_sec         integer
healthy_threshold integer
oject             string
edential          reference to gauth_credential

Actions Properties Label

Set the hhc_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_https_health_check

An HttpsHealthCheck resource. This resource defines a template for how individual VMs should be checked for health, via HTTPS.

Example
pute_https_health_check 'app-health-check' do
tion :create
c_label 'my-app-https-hc'
althy_threshold 10
rt 8080
meout_sec 2
healthy_threshold 5
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_https_health_check 'id-for-resource' do
eck_interval_sec  integer
eation_timestamp  time
scription         string
althy_threshold   integer
st                string
                  integer
me                string
rt                integer
quest_path        string
meout_sec         integer
healthy_threshold integer
oject             string
edential          reference to gauth_credential

Actions Properties Label

Set the hhc_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_health_check

An HealthCheck resource. This resource defines a template for how individual virtual machines should be checked for health, via one of the supported protocols.

Example
pute_health_check 'app-health-check' do
tion :create
pe 'TCP'
p_health_check(
port: 6123,
request: 'ping',
response: 'pong'

althy_threshold 10
meout_sec 2
healthy_threshold 5
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_health_check 'id-for-resource' do
eck_interval_sec  integer
eation_timestamp  time
scription         string
althy_threshold   integer
tp_health_check   {
host         string,
port         integer,
port_name    string,
proxy_header 'NONE' or 'PROXY_V1',
request_path string,

tps_health_check  {
host         string,
port         integer,
port_name    string,
proxy_header 'NONE' or 'PROXY_V1',
request_path string,

                  integer
me                string
l_health_check    {
port         integer,
port_name    string,
proxy_header 'NONE' or 'PROXY_V1',
request      string,
response     string,

p_health_check    {
port         integer,
port_name    string,
proxy_header 'NONE' or 'PROXY_V1',
request      string,
response     string,

meout_sec         integer
pe                'TCP', 'SSL' or 'HTTP'
healthy_threshold integer
oject             string
edential          reference to gauth_credential

Actions Properties Label

Set the hc_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_instance_template

Defines an Instance Template resource that provides configuration settings for your virtual machine instances. Instance templates are not tied to the lifetime of an instance and can be used and reused as to deploy virtual machines. You can also use different templates to create different virtual machine configurations. Instance templates are required when you create a managed instance group.

Tip: Disks should be set to autoDelete=true so that leftover disks are not left behind on machine deletion.

Example
wer Tips:
1) Remember to define the resources needed to allocate the VM:
   a) gcompute_disk_type (to be used in 'diskType' property)
   b) gcompute_machine_type (to be used in 'machine_type' property)
   c) gcompute_network (to be used in 'network_interfaces' property)
   d) gcompute_subnetwork (to be used in the 'subnetwork' property)
   e) gcompute_disk (to be used in the 'sourceDisk' property)
2) Don't forget to define a source_image for the OS of the boot disk
pute_instance_template 'instance-template-test' do
tion :create
operties(
machine_type: 'n1-standard-1',
disks: [
  {
    # Tip: Auto delete will prevent disks from being left behind on
    # deletion.
    auto_delete: true,
    boot: true,
    initialize_params: {
      disk_size_gb: 100,
      source_image:
        gcompute_image_family('ubuntu-1604-lts', 'ubuntu-os-cloud')
    }
  }
],
metadata: {
  'startup-script-url' => 'gs://graphite-playground/bootstrap.sh',
  'cost-center' => '12345'
},
network_interfaces: [
  {
    access_configs: {
      name: 'test-config',
      type: 'ONE_TO_ONE_NAT',
    },
    network: 'mynetwork-test'
  }
]

oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_instance_template 'id-for-resource' do
eation_timestamp time
scription        string
                 integer
me               string
operties         {
can_ip_forward     boolean,
description        string,
disks              [
  {
    auto_delete         boolean,
    boot                boolean,
    device_name         string,
    disk_encryption_key {
      raw_key           string,
      rsa_encrypted_key string,
      sha256            string,
    },
    index               integer,
    initialize_params   {
      disk_name                   string,
      disk_size_gb                integer,
      disk_type                   reference to gcompute_disk_type,
      source_image                string,
      source_image_encryption_key {
        raw_key string,
        sha256  string,
      },
    },
    interface           'SCSI' or 'NVME',
    mode                'READ_WRITE' or 'READ_ONLY',
    source              reference to gcompute_disk,
    type                'SCRATCH' or 'PERSISTENT',
  },
  ...
],
guest_accelerators [
  {
    accelerator_count integer,
    accelerator_type  string,
  },
  ...
],
machine_type       reference to gcompute_machine_type,
metadata           namevalues,
network_interfaces [
  {
    access_configs  [
      {
        name   string,
        nat_ip reference to gcompute_address,
        type   ONE_TO_ONE_NAT,
      },
      ...
    ],
    alias_ip_ranges [
      {
        ip_cidr_range         string,
        subnetwork_range_name string,
      },
      ...
    ],
    name            string,
    network         reference to gcompute_network,
    network_ip      string,
    subnetwork      reference to gcompute_subnetwork,
  },
  ...
],
scheduling         {
  automatic_restart   boolean,
  on_host_maintenance string,
  preemptible         boolean,
},
service_accounts   [
  {
    email  boolean,
    scopes [
      string,
      ...
    ],
  },
  ...
],
tags               {
  fingerprint string,
  items       [
    string,
    ...
  ],
},

oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the it_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_license

A License resource represents a software license. Licenses are used to track software usage in images, persistent disks, snapshots, and virtual machine instances.

Example
pute_license 'test-license' do
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_license 'id-for-resource' do
arges_use_fee boolean
me            string
oject         string
edential      reference to gauth_credential

Actions Properties Label

Set the l_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_image

Represents an Image resource.

Google Compute Engine uses operating system images to create the root persistent disks for your instances. You specify an image when you create an instance. Images contain a boot loader, an operating system, and a root file system. Linux operating system images are also capable of running containers on Compute Engine.

Images can be either public or custom.

Public images are provided and maintained by Google, open-source communities, and third-party vendors. By default, all projects have access to these images and can use them to create instances. Custom images are available only to your project. You can create a custom image from root persistent disks and other images. Then, use the custom image to create an instance.

Example
p: Be sure to include a valid gcompute_disk object
pute_image 'test-image' do
tion :create
urce_disk 'data-disk-1'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_image 'id-for-resource' do
chive_size_bytes         integer
eation_timestamp         time
precated                 {
deleted     time,
deprecated  time,
obsolete    time,
replacement string,
state       'DEPRECATED', 'OBSOLETE' or 'DELETED',

scription                string
sk_size_gb               integer
mily                     string
est_os_features          [
{
  type VIRTIO_SCSI_MULTIQUEUE,
},
...

                         integer
age_encryption_key       {
raw_key string,
sha256  string,

censes                   [
string,
...

me                       string
w_disk                   {
container_type TAR,
sha1_checksum  string,
source         string,

urce_disk                reference to gcompute_disk
urce_disk_encryption_key {
raw_key string,
sha256  string,

urce_disk_id             string
urce_type                RAW
oject                    string
edential                 reference to gauth_credential

Actions Properties Label

Set the i_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_instance

An instance is a virtual machine (VM) hosted on Google's infrastructure.

Example
wer Tips:
1) Remember to define the resources needed to allocate the VM:
   a) gcompute_disk (to be used in 'disks' property)
   b) gcompute_network (to be used in 'network' property)
   c) gcompute_address (to be used in 'access_configs', if your machine
      needs external ingress access)
   d) gcompute_zone (to determine where the VM will be allocated)
   e) gcompute_machine_type (to determine the kind of machine to be created)
2) Don't forget to define a source_image for the OS of the boot disk
   a) You can use the provided gcompute_image_family function to specify the
      latest version of an operating system of a given family
      e.g. Ubuntu 16.04
pute_instance 'instance-test' do
tion :create
chine_type 'n1-standard-1'
sks [
{
  boot: true,
  auto_delete: true,
  source: 'instance-test-os-1'
}

tadata ({
'startup-script-url' => 'gs://graphite-playground/bootstrap.sh',
'cost-center' => '12345'

twork_interfaces [
{
  network: 'mynetwork-test',
  access_configs: [
    {
      name: 'External NAT',
      nat_ip: 'instance-test-ip',
      type: 'ONE_TO_ONE_NAT'
    }
  ]
}

ne 'us-west1-a'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_instance 'id-for-resource' do
n_ip_forward     boolean
u_platform       string
eation_timestamp string
sks              [
{
  auto_delete         boolean,
  boot                boolean,
  device_name         string,
  disk_encryption_key {
    raw_key           string,
    rsa_encrypted_key string,
    sha256            string,
  },
  index               integer,
  initialize_params   {
    disk_name                   string,
    disk_size_gb                integer,
    disk_type                   reference to gcompute_disk_type,
    source_image                string,
    source_image_encryption_key {
      raw_key string,
      sha256  string,
    },
  },
  interface           'SCSI' or 'NVME',
  mode                'READ_WRITE' or 'READ_ONLY',
  source              reference to gcompute_disk,
  type                'SCRATCH' or 'PERSISTENT',
},
...

est_accelerators [
{
  accelerator_count integer,
  accelerator_type  string,
},
...

                 integer
bel_fingerprint  string
chine_type       reference to gcompute_machine_type
tadata           namevalues
n_cpu_platform   string
me               string
twork_interfaces [
{
  access_configs  [
    {
      name   string,
      nat_ip reference to gcompute_address,
      type   ONE_TO_ONE_NAT,
    },
    ...
  ],
  alias_ip_ranges [
    {
      ip_cidr_range         string,
      subnetwork_range_name string,
    },
    ...
  ],
  name            string,
  network         reference to gcompute_network,
  network_ip      string,
  subnetwork      reference to gcompute_subnetwork,
},
...

heduling         {
automatic_restart   boolean,
on_host_maintenance string,
preemptible         boolean,

rvice_accounts   [
{
  email  boolean,
  scopes [
    string,
    ...
  ],
},
...

atus             string
atus_message     string
gs               {
fingerprint string,
items       [
  string,
  ...
],

ne               reference to gcompute_zone
oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the i_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_instance_group

Represents an Instance Group resource. Instance groups are self-managed and can contain identical or different instances. Instance groups do not use an instance template. Unlike managed instance groups, you must create and add instances to an instance group manually.

Example
stance group requires a network and a region, so define them in your recipe:
- gcompute_network 'my-network' do ... end
- gcompute_zone 'my-zone' do ... end
pute_instance_group 'my-masters' do
tion :create
med_ports [
{
  name: 'test-port',
  port: 8141
}

twork 'my-network'
ne 'us-central1-a'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_instance_group 'id-for-resource' do
eation_timestamp time
scription        string
                 integer
me               string
med_ports        [
{
  name string,
  port integer,
},
...

twork            reference to gcompute_network
gion             reference to gcompute_region
bnetwork         reference to gcompute_subnetwork
ne               reference to gcompute_zone
oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the ig_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_instance_group_manager

Creates a managed instance group using the information that you specify in the request. After the group is created, it schedules an action to create instances in the group using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances.

A managed instance group can have up to 1000 VM instances per group.

Example
pute_instance_group_manager 'test1' do
tion :create
se_instance_name 'test1-child'
stance_template 'instance-template'
rget_size 3
ne 'us-west1-a'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_instance_group_manager 'id-for-resource' do
se_instance_name string
eation_timestamp time
rrent_actions    {
abandoning               integer,
creating                 integer,
creating_without_retries integer,
deleting                 integer,
none                     integer,
recreating               integer,
refreshing               integer,
restarting               integer,

scription        string
                 integer
stance_group     reference to gcompute_instance_group
stance_template  reference to gcompute_instance_template
me               string
med_ports        [
{
  name string,
  port integer,
},
...

gion             reference to gcompute_region
rget_pools       [
reference to a gcompute_target_pool,
...

rget_size        integer
ne               reference to gcompute_zone
oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the igm_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_machine_type

Represents a MachineType resource. Machine types determine the virtualized hardware specifications of your virtual machine instances, such as the amount of memory or number of virtual CPUs.

Example
pute_machine_type 'n1-standard-1' do
tion :create
ne 'us-west1-a'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_machine_type 'id-for-resource' do
eation_timestamp               time
precated                       {
deleted     time,
deprecated  time,
obsolete    time,
replacement string,
state       'DEPRECATED', 'OBSOLETE' or 'DELETED',

scription                      string
est_cpus                       integer
                               integer
_shared_cpu                    boolean
ximum_persistent_disks         integer
ximum_persistent_disks_size_gb integer
mory_mb                        integer
me                             string
ne                             reference to gcompute_zone
oject                          string
edential                       reference to gauth_credential

Actions Properties Label

Set the mt_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_network

Represents a Network resource.

Your Cloud Platform Console project can contain multiple networks, and each network can have multiple instances attached to it. A network allows you to define a gateway IP and the network range for the instances attached to that network. Every project is provided with a default network with preset configurations and firewall rules. You can choose to customize the default network by adding or removing rules, or you can create new networks in that project. Generally, most users only need one network, although you can have up to five networks per project by default.

A network belongs to only one project, and each instance can only belong to one network. All Compute Engine networks use the IPv4 protocol. Compute Engine currently does not support IPv6. However, Google is a major advocate of IPv6 and it is an important future direction.

Example
pute_network 'mynetwork' do
tion :create
to_create_subnetworks true
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_network 'id-for-resource' do
to_create_subnetworks boolean
eation_timestamp      time
scription             string
teway_ipv4            string
                      integer
v4_range              string
me                    string
bnetworks             [
string,
...

oject                 string
edential              reference to gauth_credential

Actions Properties Label

Set the n_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_region

Represents a Region resource. A region is a specific geographical location where you can run your resources. Each region has one or more zones

Example
pute_region 'us-west1' do
tion :create
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_region 'id-for-resource' do
eation_timestamp     time
precated_deleted     time
precated_deprecated  time
precated_obsolete    time
precated_replacement string
precated_state       'DEPRECATED', 'OBSOLETE' or 'DELETED'
scription            string
                     integer
me                   string
nes                  [
string,
...

oject                string
edential             reference to gauth_credential

Actions Properties Label

Set the r_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_route

Represents a Route resource.

A route is a rule that specifies how certain packets should be handled by the virtual network. Routes are associated with virtual machines by tag, and the set of routes for a particular virtual machine is called its routing table. For each packet leaving a virtual machine, the system searches that virtual machine's routing table for a single best matching route.

Routes match packets by destination IP address, preferring smaller or more specific ranges over larger ones. If there is a tie, the system selects the route with the smallest priority value. If there is still a tie, it uses the layer three and four packet headers to select just one of the remaining matching routes. The packet is then forwarded as specified by the next_hop field of the winning route – either to another virtual machine destination, a virtual machine gateway or a Compute Engine-operated gateway. Packets that do not match any route in the sending virtual machine's routing table will be dropped.

A Routes resources must have exactly one specification of either nextHopGateway, nextHopInstance, nextHopIp, or nextHopVpnTunnel.

Example
bnetwork requires a network and a region, so define them in your recipe:
- gcompute_network 'my-network' do ... end
- gcompute_region 'some-region' do ... end
pute_route 'corp-route' do
tion :create
st_range '192.168.6.0/24'
xt_hop_gateway 'global/gateways/default-internet-gateway'
gs %w[backends databases] # %w[] best for single words. use ['.'] w/ spaces
twork 'my-network'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_route 'id-for-resource' do
st_range          string
me                string
twork             reference to gcompute_network
xt_hop_gateway    string
xt_hop_instance   string
xt_hop_ip         string
xt_hop_vpn_tunnel string
iority            integer
gs                [
string,
...

oject             string
edential          reference to gauth_credential

Actions Properties Label

Set the r_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_snapshot

Represents a Persistent Disk Snapshot resource.

Use snapshots to back up data from your persistent disks. Snapshots are different from public images and custom images, which are used primarily to create instances or configure instance templates. Snapshots are useful for periodic backup of the data on your persistent disks. You can create snapshots from persistent disks even while they are attached to running instances.

Snapshots are incremental, so you can create regular snapshots on a persistent disk faster and at a much lower cost than if you regularly created a full image of the disk.

Example
pute_snapshot 'data-disk-snapshot-1' do
tion :create
apshot_encryption_key(
raw_key: 'VGhpcyBpcyBhbiBlbmNyeXB0ZWQgc25hcHNob3QhISE='

urce_disk_encryption_key(
raw_key: 'SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0='

urce 'data-disk-1'
ne 'us-central1-a'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_snapshot 'id-for-resource' do
eation_timestamp         time
scription                string
sk_size_gb               integer
                         integer
bels                     [
string,
...

censes                   [
reference to a gcompute_license,
...

me                       string
apshot_encryption_key    {
raw_key string,
sha256  string,

urce                     reference to gcompute_disk
urce_disk_encryption_key {
raw_key string,
sha256  string,

orage_bytes              integer
ne                       reference to gcompute_zone
oject                    string
edential                 reference to gauth_credential

Actions Properties Label

Set the s_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_ssl_certificate

An SslCertificate resource. This resource provides a mechanism to upload an SSL key and certificate to the load balancer to serve secure connections from the user.

Example
*****
RNING: This recipe is for example purposes only. It is *not* advisable to
ve the key embedded like this because if you check this file into source
ntrol you are publishing the private key to whomever can access the source
de.
*****

pute_ssl_certificate 'my-site-ssl-cert' do
tion :create
rtificate(
<<-CERTIFICATE
   -----BEGIN CERTIFICATE-----
   MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
   EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
   BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
   b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
   AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
   MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
   BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
   FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
   aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
   KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
   4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
   BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
   0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
   M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
   zqGNhIPGq2ULqXKK8BY=
   -----END CERTIFICATE-----
   CERTIFICATE
   .split("\n").map(&:strip).join("\n")

ivate_key(
<<-PRIVATE_KEY
   -----BEGIN EC PRIVATE KEY-----
   MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
   AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
   OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
   -----END EC PRIVATE KEY-----
   PRIVATE_KEY
   .split("\n").map(&:strip).join("\n")

oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_ssl_certificate 'id-for-resource' do
rtificate        string
eation_timestamp time
scription        string
                 integer
me               string
ivate_key        string
oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the sc_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_subnetwork

A VPC network is a virtual version of the traditional physical networks that exist within and between physical data centers. A VPC network provides connectivity for your Compute Engine virtual machine (VM) instances, Container Engine containers, App Engine Flex services, and other network-related resources.

Each GCP project contains one or more VPC networks. Each VPC network is a global entity spanning all GCP regions. This global VPC network allows VM instances and other resources to communicate with each other via internal, private IP addresses.

Each VPC network is subdivided into subnets, and each subnet is contained within a single region. You can have more than one subnet in a region for a given VPC network. Each subnet has a contiguous private RFC1918 IP space. You create instances, containers, and the like in these subnets. When you create an instance, you must create it in a subnet, and the instance draws its internal IP address from that subnet.

Virtual machine (VM) instances in a VPC network can communicate with instances in all other subnets of the same VPC network, regardless of region, using their RFC1918 private IP addresses. You can isolate portions of the network, even entire subnets, using firewall rules.

Example
bnetwork requires a network and a region, so define them in your recipe:
- gcompute_network 'my-network' do ... end
- gcompute_region 'some-region' do ... end
pute_subnetwork 'servers' do
tion :create
_cidr_range '172.16.0.0/16'
twork 'mynetwork-subnetwork'
gion 'some-region'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_subnetwork 'id-for-resource' do
eation_timestamp       time
scription              string
teway_address          string
                       integer
_cidr_range            string
me                     string
twork                  reference to gcompute_network
ivate_ip_google_access boolean
gion                   reference to gcompute_region
oject                  string
edential               reference to gauth_credential

Actions Properties Label

Set the s_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_target_http_proxy

Represents a TargetHttpProxy resource, which is used by one or more global forwarding rule to route incoming HTTP requests to a URL map.

Example
pute_target_http_proxy 'my-http-proxy' do
tion :create
l_map 'my-url-map'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_target_http_proxy 'id-for-resource' do
eation_timestamp time
scription        string
                 integer
me               string
l_map            reference to gcompute_url_map
oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the thp_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_target_https_proxy

Represents a TargetHttpsProxy resource, which is used by one or more global forwarding rule to route incoming HTTPS requests to a URL map.

Example
pute_target_https_proxy 'my-https-proxy' do
tion :create
l_certificates [
'sample-certificate'

l_map 'my-url-map'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_target_https_proxy 'id-for-resource' do
eation_timestamp time
scription        string
                 integer
me               string
l_certificates   [
reference to a gcompute_ssl_certificate,
...

l_map            reference to gcompute_url_map
oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the thp_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_target_pool

Represents a TargetPool resource, used for Load Balancing.

Example
Reference
pute_target_pool 'id-for-resource' do
ckup_pool        reference to gcompute_target_pool
eation_timestamp time
scription        string
ilover_ratio     double
alth_check       reference to gcompute_http_health_check
                 integer
stances          [
reference to a gcompute_instance,
...

me               string
gion             reference to gcompute_region
ssion_affinity   'NONE', 'CLIENT_IP' or 'CLIENT_IP_PROTO'
oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the tp_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_target_ssl_proxy

Represents a TargetSslProxy resource, which is used by one or more global forwarding rule to route incoming SSL requests to a backend service.

Example
pute_target_ssl_proxy 'my-ssl-proxy' do
tion :create
oxy_header 'PROXY_V1'
rvice 'my-ssl-backend'
l_certificates [
'sample-certificate'

oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_target_ssl_proxy 'id-for-resource' do
eation_timestamp time
scription        string
                 integer
me               string
oxy_header       'NONE' or 'PROXY_V1'
rvice            reference to gcompute_backend_service
l_certificates   [
reference to a gcompute_ssl_certificate,
...

oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the tsp_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_target_tcp_proxy

Represents a TargetTcpProxy resource, which is used by one or more global forwarding rule to route incoming TCP requests to a Backend service.

Example
pute_target_tcp_proxy 'my-tcp-proxy' do
tion :create
oxy_header 'PROXY_V1'
rvice 'my-tcp-backend'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_target_tcp_proxy 'id-for-resource' do
eation_timestamp time
scription        string
                 integer
me               string
oxy_header       'NONE' or 'PROXY_V1'
rvice            reference to gcompute_backend_service
oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the ttp_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_url_map

UrlMaps are used to route requests to a backend service based on rules that you define for the host and path of an incoming URL.

Example
pute_url_map 'my-url-map' do
tion :create
fault_service 'my-app-backend'
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_url_map 'id-for-resource' do
eation_timestamp time
fault_service    reference to gcompute_backend_service
scription        string
st_rules         [
{
  description  string,
  hosts        [
    string,
    ...
  ],
  path_matcher string,
},
...

                 integer
me               string
th_matchers      [
{
  default_service reference to gcompute_backend_service,
  description     string,
  name            string,
  path_rules      [
    {
      paths   [
        string,
        ...
      ],
      service reference to gcompute_backend_service,
    },
    ...
  ],
},
...

sts              [
{
  description string,
  host        string,
  path        string,
  service     reference to gcompute_backend_service,
},
...

oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the um_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

gcompute_zone

Represents a Zone resource.

Example
pute_zone 'us-west1-a' do
tion :create
oject 'google.com:graphite-playground'
edential 'mycred'

Reference
pute_zone 'id-for-resource' do
eation_timestamp time
precated         {
deleted     time,
deprecated  time,
obsolete    time,
replacement string,
state       'DEPRECATED', 'OBSOLETE' or 'DELETED',

scription        string
                 integer
me               string
gion             reference to gcompute_region
atus             'UP' or 'DOWN'
oject            string
edential         reference to gauth_credential

Actions Properties Label

Set the z_label property when attempting to set primary key of this object. The primary key will always be referred to by the initials of the resource followed by “_label”

Functions
About Functions

In order to use these functions inside of a Chef recipe, you'll need to import the function first. Before calling a function, add the following line:

ef::Resource.send(:include, Google::Functions)
gcompute_address_ip

Retrieves the IP address associated with a gcompute_address static IP.

Arguments Examples
pute_address_ip('my-server', 'us-central1', 'myproject', fn_auth)
gcompute_health_check_ref

Builds a reference to a health check to be used in the backend service.

Arguments Examples
nction:name}}('my-hc', 'my-project')
gcompute_image_family

Builds the family resource identifier required to uniquely identify the family, e.g. to create virtual machines based on it. You can use this function as source_image of a gcompute_instance resource.

Arguments Examples
pute_image_family('ubuntu-1604-lts', 'ubuntu-os-cloud')
uby
pute_image_family('my-web-server', 'my-project')

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.