website: document gce

This commit is contained in:
Mitchell Hashimoto 2014-08-26 14:50:29 -07:00
commit 2b4d358173
7 changed files with 391 additions and 0 deletions

68
index.html.markdown Normal file
View File

@ -0,0 +1,68 @@
---
layout: "google"
page_title: "Provider: Google Cloud"
sidebar_current: "docs-google-index"
---
# Google Cloud Provider
The Google Cloud provider is used to interact with
[Google Cloud services](https://cloud.google.com/). The provider needs
to be configured with the proper credentials before it can be used.
Use the navigation to the left to read about the available resources.
## Example Usage
```
# Configure the Google Cloud provider
provider "google" {
account_file = "account.json"
client_secrets_file = "client_secrets.json"
project = "my-gce-project"
region = "us-central1"
}
# Create a new instance
resource "google_compute_instance" "default" {
...
}
```
## Configuration Reference
The following keys can be used to configure the provider.
* `account_file` - (Required) Path to the JSON file used to describe
your account credentials, downloaded from Google Cloud Console. More
details on retrieving this file are below.
* `client_secrets_file` - (Required) Path to the JSON file containing
the secrets for your account, downloaded from Google Cloud Console.
More details on retrieving this file are below.
* `project` - (Required) The name of the project to apply any resources to.
* `region` - (Required) The region to operate under.
## Authentication JSON Files
Authenticating with Google Cloud services requires two separate JSON
files: one which we call the _account file_ and the _client secrets file_.
Both of these files are downloaded directly from the
[Google Developers Console](https://console.developers.google.com). To make
the process more straightforwarded, it is documented here.
1. Log into the [Google Developers Console](https://console.developers.google.com)
and select a project.
2. Under the "APIs & Auth" section, click "Credentials."
3. Click the "Download JSON" button under the "Compute Engine and App Engine"
account in the OAuth section. The file should start with "client\_secrets".
This is your _client secrets file_.
4. Create a new OAuth client ID and select "Service Account" as the type
of account. Once created, a JSON file should be downloaded. This is your
_account file_.

View File

@ -0,0 +1,31 @@
---
layout: "google"
page_title: "Google: google_compute_address"
sidebar_current: "docs-google-resource-address"
---
# google\_compute\_address
Creates a static IP address resource for Google Compute Engine.
## Example Usage
```
resource "google_compute_address" "default" {
name = "test-address"
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) A unique name for the resource, required by GCE.
Changing this forces a new resource to be created.
## Attributes Reference
The following attributes are exported:
* `name` - The name of the resource.
* `address` - The IP address that was allocated.

View File

@ -0,0 +1,42 @@
---
layout: "google"
page_title: "Google: google_compute_disk"
sidebar_current: "docs-google-resource-disk"
---
# google\_compute\_disk
Creates a new persistent disk within GCE, based on another disk.
## Example Usage
```
resource "google_compute_disk" "default" {
name = "test-disk"
zone = "us-central1-a"
image = "debian7-wheezy"
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) A unique name for the resource, required by GCE.
Changing this forces a new resource to be created.
* `zone` - (Required) The zone where this disk will be available.
* `image` - (Optional) The machine image to base this disk off of.
* `size` - (Optional) The size of the image in gigabytes. If not specified,
it will inherit the size of its base image.
## Attributes Reference
The following attributes are exported:
* `name` - The name of the resource.
* `zone` - The zone where the resource is located.
* `image` - The name of the image the disk is based off of.
* `size` - The size of the disk in gigabytes.

View File

@ -0,0 +1,62 @@
---
layout: "google"
page_title: "Google: google_compute_firewall"
sidebar_current: "docs-google-resource-firewall"
---
# google\_compute\_firewall
Manages a firewall resource within GCE.
## Example Usage
```
resource "google_compute_firewall" "default" {
name = "test"
network = "${google_compute_network.other.name}"
allow {
protocol = "icmp"
}
allow {
protocol = "tcp"
ports = ["80", "8080", "1000-2000"]
}
source_tags = ["web"]
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) A unique name for the resource, required by GCE.
Changing this forces a new resource to be created.
* `network` - (Required) The name of the network to attach this firewall to.
* `allow` - (Required) Can be specified multiple times for each allow
rule. Each allow block supports fields documented below.
* `source_ranges` - (Optional) A list of source CIDR ranges that this
firewall applies to.
* `source_tags` - (Optional) A list of tags that this firewall applies to.
The `allow` block supports:
* `protocol` - (Required) The name of the protocol to allow.
* `ports` - (Optional) List of ports and/or port ranges to allow. This can
only be specified if the protocol is TCP or UDP.
## Attributes Reference
The following attributes are exported:
* `name` - The name of the resource.
* `network` - The network that this resource is attached to.
* `source_ranges` - The CIDR block ranges this firewall applies to.
* `source_tags` - The tags that this firewall applies to.

View File

@ -0,0 +1,80 @@
---
layout: "google"
page_title: "Google: google_compute_instance"
sidebar_current: "docs-google-resource-instance"
---
# google\_compute\_instance
Manages a VM instance resource within GCE.
## Example Usage
```
resource "google_compute_instance" "default" {
name = "test"
machine_type = "n1-standard-1"
zone = "us-central1-a"
tags = ["foo", "bar"]
disk {
image = "debian-7-wheezy-v20140814"
}
network {
source = "default"
}
metadata {
foo = "bar"
}
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) A unique name for the resource, required by GCE.
Changing this forces a new resource to be created.
* `description` - (Optional) A brief description of this resource.
* `machine_type` - (Required) The machine type to create.
* `zone` - (Required) The zone that the machine should be created in.
* `disk` - (Required) Disks to attach to the instance. This can be specified
multiple times for multiple disks. Structure is documented below.
* `metadata` - (Optional) Metadata key/value pairs to make available from
within the instance.
* `network` - (Required) Networks to attach to the instance. This can be
specified multiple times for multiple networks. Structure is documented
below.
* `tags` - (Optional) Tags to attach to the instance.
The `disk` block supports:
* `disk` - (Required if image not set) The name of the disk (such as
those managed by `google_compute_disk`) to attach.
* `image` - (Required if disk not set) The name of the image to base
this disk off of.
The `network` block supports:
* `source` - (Required) The name of the network to attach this interface to.
* `address` - (Optional) The IP address of a reserved IP address to assign
to this interface.
## Attributes Reference
The following attributes are exported:
* `name` - The name of the resource.
* `machine_type` - The type of machine.
* `zone` - The zone the machine lives in.

View File

@ -0,0 +1,36 @@
---
layout: "google"
page_title: "Google: google_compute_network"
sidebar_current: "docs-google-resource-network"
---
# google\_compute\_network
Manages a network within GCE.
## Example Usage
```
resource "google_compute_network" "default" {
name = "test"
ipv4_range = "10.0.0.0/16"
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) A unique name for the resource, required by GCE.
Changing this forces a new resource to be created.
* `ipv4_range` - (Required) The IPv4 address range that machines in this
network are assigned to, represented as a CIDR block.
## Attributes Reference
The following attributes are exported:
* `name` - The name of the resource.
* `ipv4_range` - The CIDR block of this network.
* `gateway_ipv4` - The IPv4 address of the gateway.

View File

@ -0,0 +1,72 @@
---
layout: "google"
page_title: "Google: google_compute_route"
sidebar_current: "docs-google-resource-route"
---
# google\_compute\_route
Manages a network route within GCE.
## Example Usage
```
resource "google_compute_network" "foobar" {
name = "test"
ipv4_range = "10.0.0.0/16"
}
resource "google_compute_route" "foobar" {
name = "test"
dest_range = "15.0.0.0/24"
network = "${google_compute_network.foobar.name}"
next_hop_ip = "10.0.1.5"
priority = 100
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) A unique name for the resource, required by GCE.
Changing this forces a new resource to be created.
* `dest_range` - (Required) The destination IPv4 address range that this
route applies to.
* `network` - (Required) The name of the network to attach this route to.
* `next_hop_ip` - (Optional) The IP address of the next hop if this route
is matched.
* `next_hop_instance` - (Optional) The name of the VM instance to route to
if this route is matched.
* `next_hop_instance_zone` - (Optional) The zone of the instance specified
in `next_hop_instance`.
* `next_hop_gateway` - (Optional) The name of the internet gateway to route
to if this route is matched.
* `next_hop_network` - (Optional) The name of the network to route to if this
route is matched.
* `priority` - (Required) The priority of this route, used to break ties.
* `tags` - (Optional) The tags that this route applies to.
## Attributes Reference
The following attributes are exported:
* `name` - The name of the resource.
* `dest_range` - The detination CIDR block of this route.
* `network` - The name of the network of this route.
* `next_hop_ip` - The IP address of the next hop, if available.
* `next_hop_instance` - The name of the instance of the next hop, if available.
* `next_hop_instance_zone` - The zone of the next hop instance, if available.
* `next_hop_gateway` - The name of the next hop gateway, if available.
* `next_hop_network` - The name of the next hop network, if available.
* `priority` - The priority of this route.
* `tags` - The tags this route applies to.