website: document gce

This commit is contained in:
Mitchell Hashimoto 2014-08-26 14:50:29 -07:00
parent ea585a5950
commit 7d5a96278d
11 changed files with 446 additions and 1 deletions

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.

View File

@ -96,6 +96,10 @@
<a href="/docs/providers/dnsimple/index.html">DNSimple</a>
</li>
<li<%= sidebar_current("docs-providers-google") %>>
<a href="/docs/providers/google/index.html">Google Cloud</a>
</li>
<li<%= sidebar_current("docs-providers-heroku") %>>
<a href="/docs/providers/heroku/index.html">Heroku</a>
</li>

View File

@ -0,0 +1,46 @@
<% wrap_layout :inner do %>
<% content_for :sidebar do %>
<div class="docs-sidebar hidden-print affix-top" role="complementary">
<ul class="nav docs-sidenav">
<li<%= sidebar_current("docs-home") %>>
<a href="/docs/index.html">&laquo; Documentation Home</a>
</li>
<li<%= sidebar_current("docs-google-index") %>>
<a href="/docs/providers/google/index.html">google Provider</a>
</li>
<li<%= sidebar_current("docs-google-resource") %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-google-resource-address") %>>
<a href="/docs/providers/google/r/compute_address.html">google_compute_address</a>
</li>
<li<%= sidebar_current("docs-google-resource-disk") %>>
<a href="/docs/providers/google/r/compute_disk.html">google_compute_disk</a>
</li>
<li<%= sidebar_current("docs-google-resource-firewall") %>>
<a href="/docs/providers/google/r/compute_firewall.html">google_compute_firewall</a>
</li>
<li<%= sidebar_current("docs-google-resource-instance") %>>
<a href="/docs/providers/google/r/compute_instance.html">google_compute_instance</a>
</li>
<li<%= sidebar_current("docs-google-resource-network") %>>
<a href="/docs/providers/google/r/compute_network.html">google_compute_network</a>
</li>
<li<%= sidebar_current("docs-google-resource-route") %>>
<a href="/docs/providers/google/r/compute_route.html">google_compute_route</a>
</li>
</ul>
</li>
</ul>
</div>
<% end %>
<%= yield %>
<% end %>

View File

@ -9,6 +9,7 @@ body.page-sub{
body.layout-consul,
body.layout-dnsimple,
body.layout-cloudflare,
body.layout-google,
body.layout-heroku,
body.layout-digitalocean,
body.layout-aws,
@ -17,7 +18,7 @@ body.layout-inner,
body.layout-downloads,
body.layout-intro{
background: @light-black url('../images/sidebar-wire.png') left 62px no-repeat;
>.container{
.col-md-8[role=main]{
min-height: 800px;

View File

@ -1617,6 +1617,7 @@ body.page-sub {
body.layout-consul,
body.layout-dnsimple,
body.layout-cloudflare,
body.layout-google,
body.layout-heroku,
body.layout-digitalocean,
body.layout-aws,
@ -1629,6 +1630,7 @@ body.layout-intro {
body.layout-consul > .container .col-md-8[role=main],
body.layout-dnsimple > .container .col-md-8[role=main],
body.layout-cloudflare > .container .col-md-8[role=main],
body.layout-google > .container .col-md-8[role=main],
body.layout-heroku > .container .col-md-8[role=main],
body.layout-digitalocean > .container .col-md-8[role=main],
body.layout-aws > .container .col-md-8[role=main],
@ -1642,6 +1644,7 @@ body.layout-intro > .container .col-md-8[role=main] {
body.layout-consul > .container .col-md-8[role=main] > div,
body.layout-dnsimple > .container .col-md-8[role=main] > div,
body.layout-cloudflare > .container .col-md-8[role=main] > div,
body.layout-google > .container .col-md-8[role=main] > div,
body.layout-heroku > .container .col-md-8[role=main] > div,
body.layout-digitalocean > .container .col-md-8[role=main] > div,
body.layout-aws > .container .col-md-8[role=main] > div,