Skip to content

Commit 7d5a962

Browse files
committed
website: document gce
1 parent ea585a5 commit 7d5a962

11 files changed

Lines changed: 446 additions & 1 deletion
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
layout: "google"
3+
page_title: "Provider: Google Cloud"
4+
sidebar_current: "docs-google-index"
5+
---
6+
7+
# Google Cloud Provider
8+
9+
The Google Cloud provider is used to interact with
10+
[Google Cloud services](https://cloud.google.com/). The provider needs
11+
to be configured with the proper credentials before it can be used.
12+
13+
Use the navigation to the left to read about the available resources.
14+
15+
## Example Usage
16+
17+
```
18+
# Configure the Google Cloud provider
19+
provider "google" {
20+
account_file = "account.json"
21+
client_secrets_file = "client_secrets.json"
22+
project = "my-gce-project"
23+
region = "us-central1"
24+
}
25+
26+
# Create a new instance
27+
resource "google_compute_instance" "default" {
28+
...
29+
}
30+
```
31+
32+
## Configuration Reference
33+
34+
The following keys can be used to configure the provider.
35+
36+
* `account_file` - (Required) Path to the JSON file used to describe
37+
your account credentials, downloaded from Google Cloud Console. More
38+
details on retrieving this file are below.
39+
40+
* `client_secrets_file` - (Required) Path to the JSON file containing
41+
the secrets for your account, downloaded from Google Cloud Console.
42+
More details on retrieving this file are below.
43+
44+
* `project` - (Required) The name of the project to apply any resources to.
45+
46+
* `region` - (Required) The region to operate under.
47+
48+
## Authentication JSON Files
49+
50+
Authenticating with Google Cloud services requires two separate JSON
51+
files: one which we call the _account file_ and the _client secrets file_.
52+
53+
Both of these files are downloaded directly from the
54+
[Google Developers Console](https://console.developers.google.com). To make
55+
the process more straightforwarded, it is documented here.
56+
57+
1. Log into the [Google Developers Console](https://console.developers.google.com)
58+
and select a project.
59+
60+
2. Under the "APIs & Auth" section, click "Credentials."
61+
62+
3. Click the "Download JSON" button under the "Compute Engine and App Engine"
63+
account in the OAuth section. The file should start with "client\_secrets".
64+
This is your _client secrets file_.
65+
66+
4. Create a new OAuth client ID and select "Service Account" as the type
67+
of account. Once created, a JSON file should be downloaded. This is your
68+
_account file_.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
layout: "google"
3+
page_title: "Google: google_compute_address"
4+
sidebar_current: "docs-google-resource-address"
5+
---
6+
7+
# google\_compute\_address
8+
9+
Creates a static IP address resource for Google Compute Engine.
10+
11+
## Example Usage
12+
13+
```
14+
resource "google_compute_address" "default" {
15+
name = "test-address"
16+
}
17+
```
18+
19+
## Argument Reference
20+
21+
The following arguments are supported:
22+
23+
* `name` - (Required) A unique name for the resource, required by GCE.
24+
Changing this forces a new resource to be created.
25+
26+
## Attributes Reference
27+
28+
The following attributes are exported:
29+
30+
* `name` - The name of the resource.
31+
* `address` - The IP address that was allocated.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
layout: "google"
3+
page_title: "Google: google_compute_disk"
4+
sidebar_current: "docs-google-resource-disk"
5+
---
6+
7+
# google\_compute\_disk
8+
9+
Creates a new persistent disk within GCE, based on another disk.
10+
11+
## Example Usage
12+
13+
```
14+
resource "google_compute_disk" "default" {
15+
name = "test-disk"
16+
zone = "us-central1-a"
17+
image = "debian7-wheezy"
18+
}
19+
```
20+
21+
## Argument Reference
22+
23+
The following arguments are supported:
24+
25+
* `name` - (Required) A unique name for the resource, required by GCE.
26+
Changing this forces a new resource to be created.
27+
28+
* `zone` - (Required) The zone where this disk will be available.
29+
30+
* `image` - (Optional) The machine image to base this disk off of.
31+
32+
* `size` - (Optional) The size of the image in gigabytes. If not specified,
33+
it will inherit the size of its base image.
34+
35+
## Attributes Reference
36+
37+
The following attributes are exported:
38+
39+
* `name` - The name of the resource.
40+
* `zone` - The zone where the resource is located.
41+
* `image` - The name of the image the disk is based off of.
42+
* `size` - The size of the disk in gigabytes.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
layout: "google"
3+
page_title: "Google: google_compute_firewall"
4+
sidebar_current: "docs-google-resource-firewall"
5+
---
6+
7+
# google\_compute\_firewall
8+
9+
Manages a firewall resource within GCE.
10+
11+
## Example Usage
12+
13+
```
14+
resource "google_compute_firewall" "default" {
15+
name = "test"
16+
network = "${google_compute_network.other.name}"
17+
18+
allow {
19+
protocol = "icmp"
20+
}
21+
22+
allow {
23+
protocol = "tcp"
24+
ports = ["80", "8080", "1000-2000"]
25+
}
26+
27+
source_tags = ["web"]
28+
}
29+
```
30+
31+
## Argument Reference
32+
33+
The following arguments are supported:
34+
35+
* `name` - (Required) A unique name for the resource, required by GCE.
36+
Changing this forces a new resource to be created.
37+
38+
* `network` - (Required) The name of the network to attach this firewall to.
39+
40+
* `allow` - (Required) Can be specified multiple times for each allow
41+
rule. Each allow block supports fields documented below.
42+
43+
* `source_ranges` - (Optional) A list of source CIDR ranges that this
44+
firewall applies to.
45+
46+
* `source_tags` - (Optional) A list of tags that this firewall applies to.
47+
48+
The `allow` block supports:
49+
50+
* `protocol` - (Required) The name of the protocol to allow.
51+
52+
* `ports` - (Optional) List of ports and/or port ranges to allow. This can
53+
only be specified if the protocol is TCP or UDP.
54+
55+
## Attributes Reference
56+
57+
The following attributes are exported:
58+
59+
* `name` - The name of the resource.
60+
* `network` - The network that this resource is attached to.
61+
* `source_ranges` - The CIDR block ranges this firewall applies to.
62+
* `source_tags` - The tags that this firewall applies to.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
layout: "google"
3+
page_title: "Google: google_compute_instance"
4+
sidebar_current: "docs-google-resource-instance"
5+
---
6+
7+
# google\_compute\_instance
8+
9+
Manages a VM instance resource within GCE.
10+
11+
## Example Usage
12+
13+
```
14+
resource "google_compute_instance" "default" {
15+
name = "test"
16+
machine_type = "n1-standard-1"
17+
zone = "us-central1-a"
18+
tags = ["foo", "bar"]
19+
20+
disk {
21+
image = "debian-7-wheezy-v20140814"
22+
}
23+
24+
network {
25+
source = "default"
26+
}
27+
28+
metadata {
29+
foo = "bar"
30+
}
31+
}
32+
```
33+
34+
## Argument Reference
35+
36+
The following arguments are supported:
37+
38+
* `name` - (Required) A unique name for the resource, required by GCE.
39+
Changing this forces a new resource to be created.
40+
41+
* `description` - (Optional) A brief description of this resource.
42+
43+
* `machine_type` - (Required) The machine type to create.
44+
45+
* `zone` - (Required) The zone that the machine should be created in.
46+
47+
* `disk` - (Required) Disks to attach to the instance. This can be specified
48+
multiple times for multiple disks. Structure is documented below.
49+
50+
* `metadata` - (Optional) Metadata key/value pairs to make available from
51+
within the instance.
52+
53+
* `network` - (Required) Networks to attach to the instance. This can be
54+
specified multiple times for multiple networks. Structure is documented
55+
below.
56+
57+
* `tags` - (Optional) Tags to attach to the instance.
58+
59+
The `disk` block supports:
60+
61+
* `disk` - (Required if image not set) The name of the disk (such as
62+
those managed by `google_compute_disk`) to attach.
63+
64+
* `image` - (Required if disk not set) The name of the image to base
65+
this disk off of.
66+
67+
The `network` block supports:
68+
69+
* `source` - (Required) The name of the network to attach this interface to.
70+
71+
* `address` - (Optional) The IP address of a reserved IP address to assign
72+
to this interface.
73+
74+
## Attributes Reference
75+
76+
The following attributes are exported:
77+
78+
* `name` - The name of the resource.
79+
* `machine_type` - The type of machine.
80+
* `zone` - The zone the machine lives in.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
layout: "google"
3+
page_title: "Google: google_compute_network"
4+
sidebar_current: "docs-google-resource-network"
5+
---
6+
7+
# google\_compute\_network
8+
9+
Manages a network within GCE.
10+
11+
## Example Usage
12+
13+
```
14+
resource "google_compute_network" "default" {
15+
name = "test"
16+
ipv4_range = "10.0.0.0/16"
17+
}
18+
```
19+
20+
## Argument Reference
21+
22+
The following arguments are supported:
23+
24+
* `name` - (Required) A unique name for the resource, required by GCE.
25+
Changing this forces a new resource to be created.
26+
27+
* `ipv4_range` - (Required) The IPv4 address range that machines in this
28+
network are assigned to, represented as a CIDR block.
29+
30+
## Attributes Reference
31+
32+
The following attributes are exported:
33+
34+
* `name` - The name of the resource.
35+
* `ipv4_range` - The CIDR block of this network.
36+
* `gateway_ipv4` - The IPv4 address of the gateway.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
layout: "google"
3+
page_title: "Google: google_compute_route"
4+
sidebar_current: "docs-google-resource-route"
5+
---
6+
7+
# google\_compute\_route
8+
9+
Manages a network route within GCE.
10+
11+
## Example Usage
12+
13+
```
14+
resource "google_compute_network" "foobar" {
15+
name = "test"
16+
ipv4_range = "10.0.0.0/16"
17+
}
18+
19+
resource "google_compute_route" "foobar" {
20+
name = "test"
21+
dest_range = "15.0.0.0/24"
22+
network = "${google_compute_network.foobar.name}"
23+
next_hop_ip = "10.0.1.5"
24+
priority = 100
25+
}
26+
```
27+
28+
## Argument Reference
29+
30+
The following arguments are supported:
31+
32+
* `name` - (Required) A unique name for the resource, required by GCE.
33+
Changing this forces a new resource to be created.
34+
35+
* `dest_range` - (Required) The destination IPv4 address range that this
36+
route applies to.
37+
38+
* `network` - (Required) The name of the network to attach this route to.
39+
40+
* `next_hop_ip` - (Optional) The IP address of the next hop if this route
41+
is matched.
42+
43+
* `next_hop_instance` - (Optional) The name of the VM instance to route to
44+
if this route is matched.
45+
46+
* `next_hop_instance_zone` - (Optional) The zone of the instance specified
47+
in `next_hop_instance`.
48+
49+
* `next_hop_gateway` - (Optional) The name of the internet gateway to route
50+
to if this route is matched.
51+
52+
* `next_hop_network` - (Optional) The name of the network to route to if this
53+
route is matched.
54+
55+
* `priority` - (Required) The priority of this route, used to break ties.
56+
57+
* `tags` - (Optional) The tags that this route applies to.
58+
59+
## Attributes Reference
60+
61+
The following attributes are exported:
62+
63+
* `name` - The name of the resource.
64+
* `dest_range` - The detination CIDR block of this route.
65+
* `network` - The name of the network of this route.
66+
* `next_hop_ip` - The IP address of the next hop, if available.
67+
* `next_hop_instance` - The name of the instance of the next hop, if available.
68+
* `next_hop_instance_zone` - The zone of the next hop instance, if available.
69+
* `next_hop_gateway` - The name of the next hop gateway, if available.
70+
* `next_hop_network` - The name of the next hop network, if available.
71+
* `priority` - The priority of this route.
72+
* `tags` - The tags this route applies to.

0 commit comments

Comments
 (0)