<a id="cloud-gce"></a>

# The Google GCE cloud and Juju

This document describes details specific to using your existing Google GCE cloud with Juju.

> See more: [Google GCE](https://cloud.google.com/compute)

When using this cloud with Juju, it is important to keep in mind that it is a (1) machine cloud and (2) not some other cloud.

> See more: [Cloud differences](https://documentation.ubuntu.com/juju/2.9/reference/cloud.md#cloud-differences)

As the differences related to (1) are already documented generically in the rest of the docs, here we record just those that follow from (2).

## Requirements:

Permissions: Service Account Key Admin, Compute Instance Admin, and Compute Security Admin. <br> See more: [Google | Compute Engine IAM roles and permissions](https://cloud.google.com/compute/docs/access/iam).

## Notes on `juju add-cloud`

Type in Juju: `gce`

Name in Juju: `google`

## Notes on `juju add-credential`

### Authentication types

#### `oauth2`

Attributes:

- client-id: client ID (required)
- client-email: client e-mail address (required)
- private-key: client secret (required)
- project-id: project ID (required)

#### `jsonfile`

Attributes:

- file: path to the .json file containing a service account key for your project
  Path (required)

### If you want to use environment variables:

`CLOUDSDK_COMPUTE_REGION` <p> - `GOOGLE_APPLICATION_CREDENTIALS=<link to JSON credentials file>`

<!--
## Notes on \`juju bootstrap\`
-->

## Cloud-specific model configuration keys

### base-image-path

Base path to look for machine disk images.

|               |               |
|---------------|---------------|
| type          | string        |
| default value | schema.omit{} |
| immutable     | false         |
| mandatory     | false         |

## Supported constraints

| [CONSTRAINT](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint)                              |                                                     |
|---------------------------------------------------------------------------------------------------|-----------------------------------------------------|
| conflicting:                                                                                      | `instance-type` vs. `[arch, cores, cpu-power, mem]` |
| supported?                                                                                        |                                                     |
| - [allocate-public-ip](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-allocate-public-ip) | ✓                                                   |
| - [arch](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-arch)                             | ✓                                                   |
| - [container](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-container)                   | ✓                                                   |
| - [cores](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-cores)                           | ✓                                                   |
| - [cpu-power](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-cpu-power)                   | ✓                                                   |
| - [image-id](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-image-id)                     | ✕                                                   |
| - [instance-role](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-instance-role)           | ✕                                                   |
| - [instance-type](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-instance-type)           | ✓                                                   |
| - [mem](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-mem)                               | ✓                                                   |
| - [root-disk](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-root-disk)                   | ✓                                                   |
| - [root-disk-source](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-root-disk-source)     | ✕                                                   |
| - [spaces](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-spaces)                         | ✕                                                   |
| - [tags](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-tags)                             | ✕                                                   |
| - [virt-type](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-virt-type)                   | ✕                                                   |
| - [zones](https://documentation.ubuntu.com/juju/2.9/reference/constraint.md#constraint-zones)                           | ✓                                                   |

## Supported placement directives

| [PLACEMENT DIRECTIVE](https://documentation.ubuntu.com/juju/2.9/reference/placement-directive.md#placement-directive)             |     |
|----------------------------------------------------------------------------------------------------|-----|
| [<machine>](https://documentation.ubuntu.com/juju/2.9/reference/placement-directive.md#placement-directive-machine)               | TBA |
| [subnet=<subnet>](https://documentation.ubuntu.com/juju/2.9/reference/placement-directive.md#placement-directive-subnet)          | ✕   |
| [system-id=<system ID>](https://documentation.ubuntu.com/juju/2.9/reference/placement-directive.md#placement-directive-system-id) | ✕   |
| [zone=<zone>](https://documentation.ubuntu.com/juju/2.9/reference/placement-directive.md#placement-directive-zone)                | ✓   |
