website/docs: Run terraform fmt on code examples (#12075)

* docs/vsphere: Fix code block

* docs: Convert `...` to `# ...` to allow `terraform fmt`ing

* docs: Trim trailing whitespace

* docs: First-pass run of `terraform fmt` on code examples
This commit is contained in:
George Christou 2017-02-18 22:48:50 +00:00 committed by Paul Stack
parent fc78bd934d
commit 06fa75423e
24 changed files with 75 additions and 63 deletions

View File

@ -16,12 +16,15 @@ other Google Cloud Platform resources, such as the `google_project` resource.
data "google_iam_policy" "admin" {
binding {
role = "roles/compute.instanceAdmin"
members = [
"serviceAccount:your-custom-sa@your-project.iam.gserviceaccount.com",
]
}
binding {
role = "roles/storage.objectViewer"
members = [
"user:evanbrown@google.com",
]

View File

@ -41,6 +41,7 @@ resource "google_compute_url_map" "default" {
path_matcher {
name = "allpaths"
default_service = "${google_compute_backend_service.default.self_link}"
path_rule {
paths = ["/*"]
service = "${google_compute_backend_service.default.self_link}"

View File

@ -23,6 +23,7 @@ resource "google_compute_health_check" "default" {
timeout_sec = 1
check_interval_sec = 1
tcp_health_check {
port = "80"
}

View File

@ -17,7 +17,8 @@ tarball. For more information see [the official documentation](https://cloud.goo
```js
resource "google_compute_image" "bootable-image" {
name = "my-custom-image"
name = "my-custom-image"
raw_disk {
source = "https://storage.googleapis.com/my-bucket/my-disk-image-tarball.tar.gz"
}
@ -33,7 +34,7 @@ resource "google_compute_instance" "vm" {
}
network_interface {
network = "default"
network = "default"
}
}
```

View File

@ -36,6 +36,7 @@ resource "google_compute_instance" "default" {
network_interface {
network = "default"
access_config {
// Ephemeral IP
}
@ -72,7 +73,7 @@ The following arguments are supported:
* `network_interface` - (Required) Networks to attach to the instance. This can
be specified multiple times for multiple networks, but GCE is currently
limited to just 1. Structure is documented below.
- - -
* `can_ip_forward` - (Optional) Whether to allow sending and receiving of
@ -103,7 +104,7 @@ The following arguments are supported:
* `create_timeout` - (Optional) Configurable timeout in minutes for creating instances. Default is 4 minutes.
Changing this forces a new resource to be created.
---
* `network` - (DEPRECATED, Required) Networks to attach to the instance. This

View File

@ -32,7 +32,7 @@ resource "google_compute_instance_group" "webservers" {
instances = [
"${google_compute_instance.test.self_link}",
"${google_compute_instance.test2.self_link}"
"${google_compute_instance.test2.self_link}",
]
named_port {

View File

@ -36,8 +36,8 @@ resource "google_compute_instance_template" "foobar" {
// Create a new boot disk from an image
disk {
source_image = "debian-cloud/debian-8"
auto_delete = true
boot = true
auto_delete = true
boot = true
}
// Use an existing disk resource
@ -73,31 +73,31 @@ with `name_prefix`. Example:
```
resource "google_compute_instance_template" "instance_template" {
name_prefix = "instance-template-"
machine_type = "n1-standard-1"
region = "us-central1"
name_prefix = "instance-template-"
machine_type = "n1-standard-1"
region = "us-central1"
// boot disk
disk {
...
}
// boot disk
disk {
# ...
}
// networking
network_interface {
...
}
// networking
network_interface {
# ...
}
lifecycle {
create_before_destroy = true
}
lifecycle {
create_before_destroy = true
}
}
resource "google_compute_instance_group_manager" "instance_group_manager" {
name = "instance-group-manager"
instance_template = "${google_compute_instance_template.instance_template.self_link}"
base_instance_name = "instance-group-manager"
zone = "us-central1-f"
target_size = "1"
name = "instance-group-manager"
instance_template = "${google_compute_instance_template.instance_template.self_link}"
base_instance_name = "instance-group-manager"
zone = "us-central1-f"
target_size = "1"
}
```

View File

@ -39,7 +39,7 @@ The following arguments are supported:
* `ipv4_range` - (DEPRECATED, Optional) The IPv4 address range that machines in this network
are assigned to, represented as a CIDR block. If not set, an auto or custom
subnetted network will be created, depending on the value of
subnetted network will be created, depending on the value of
`auto_create_subnetworks` attribute. This attribute may not be used if
`auto_create_subnetworks` is specified. This attribute is deprecated.

View File

@ -12,12 +12,12 @@ Manages metadata common to all instances for a project in GCE.
## Example Usage
```js
```
resource "google_compute_project_metadata" "default" {
metadata {
foo = "bar"
fizz = "buzz"
13 = "42"
"13" = "42"
}
}
```

View File

@ -16,11 +16,11 @@ See [backendServices](https://cloud.google.com/compute/docs/reference/latest/bac
```tf
resource "google_compute_region_backend_service" "foobar" {
name = "blablah"
description = "Hello World 1234"
protocol = "TCP"
timeout_sec = 10
session_affinity = "CLIENT_IP"
name = "blablah"
description = "Hello World 1234"
protocol = "TCP"
timeout_sec = 10
session_affinity = "CLIENT_IP"
backend {
group = "${google_compute_instance_group_manager.foo.instance_group}"
@ -57,6 +57,7 @@ resource "google_compute_health_check" "default" {
check_interval_sec = 1
timeout_sec = 1
type = "TCP"
tcp_health_check {
port = "80"
}

View File

@ -31,7 +31,7 @@ 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 network name or resource link to the parent
* `network` - (Required) The network name or resource link to the parent
network of this subnetwork. The parent network must have been created
in custom subnet mode.

View File

@ -39,7 +39,7 @@ resource "google_compute_url_map" "default" {
default_service = "${google_compute_backend_service.default.self_link}"
path_rule {
paths = ["/*"]
paths = ["/*"]
service = "${google_compute_backend_service.default.self_link}"
}
}

View File

@ -47,7 +47,7 @@ resource "google_compute_url_map" "default" {
default_service = "${google_compute_backend_service.default.self_link}"
path_rule {
paths = ["/*"]
paths = ["/*"]
service = "${google_compute_backend_service.default.self_link}"
}
}

View File

@ -89,7 +89,7 @@ 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 or resource link to the network this VPN gateway
* `network` - (Required) The name or resource link to the network this VPN gateway
is accepting traffic for. Changing this forces a new resource to be created.
- - -

View File

@ -66,7 +66,7 @@ resource "google_compute_vpn_tunnel" "tunnel1" {
target_vpn_gateway = "${google_compute_vpn_gateway.target_gateway.self_link}"
local_traffic_selector = ["${google_compute_subnetwork.subnet1.ip_cidr_range}"]
local_traffic_selector = ["${google_compute_subnetwork.subnet1.ip_cidr_range}"]
remote_traffic_selector = ["172.16.0.0/12"]
depends_on = [

View File

@ -16,13 +16,13 @@ whole cluster!
```js
resource "google_container_cluster" "primary" {
name = "marcellus-wallace"
zone = "us-central1-a"
name = "marcellus-wallace"
zone = "us-central1-a"
initial_node_count = 3
additional_zones = [
"us-central1-b",
"us-central1-c"
"us-central1-c",
]
master_auth {
@ -35,7 +35,7 @@ resource "google_container_cluster" "primary" {
"https://www.googleapis.com/auth/compute",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring"
"https://www.googleapis.com/auth/monitoring",
]
}
}
@ -83,8 +83,8 @@ resource "google_container_cluster" "primary" {
this cluster
* `node_version` - (Optional) The Kubernetes version on the nodes. Also affects
the initial master version on cluster creation. Updates affect nodes only.
Defaults to the default version set by GKE which is not necessarily the latest
the initial master version on cluster creation. Updates affect nodes only.
Defaults to the default version set by GKE which is not necessarily the latest
version.
* `project` - (Optional) The project in which the resource belongs. If it

View File

@ -25,10 +25,11 @@ resource "google_compute_instance" "frontend" {
}
network_interface {
network = "default"
access_config {}
network = "default"
access_config = {}
}
}
resource "google_dns_managed_zone" "prod" {
name = "prod-zone"
dns_name = "prod.mydomain.com."

View File

@ -3,7 +3,7 @@ layout: "google"
page_title: "Google: google_project"
sidebar_current: "docs-google-project"
description: |-
Allows management of a Google Cloud Platform project.
Allows management of a Google Cloud Platform project.
---
# google\_project
@ -23,9 +23,9 @@ doc for more information.
```js
resource "google_project" "my_project" {
project_id = "your-project-id"
org_id = "1234567"
services = ["compute_component", "storage-component-json.googleapis.com", "iam.googleapis.com"]
project_id = "your-project-id"
org_id = "1234567"
services = ["compute_component", "storage-component-json.googleapis.com", "iam.googleapis.com"]
}
```

View File

@ -3,7 +3,7 @@ layout: "google"
page_title: "Google: google_project_iam_policy"
sidebar_current: "docs-google-project-iam-policy"
description: |-
Allows management of an IAM policy for a Google Cloud Platform project.
Allows management of an IAM policy for a Google Cloud Platform project.
---
# google\_project\_iam\_policy
@ -15,13 +15,14 @@ Platform project.
```js
resource "google_project_iam_policy" "project" {
project = "your-project-id"
policy_data = "${data.google_iam_policy.admin.policy_data}"
project = "your-project-id"
policy_data = "${data.google_iam_policy.admin.policy_data}"
}
data "google_iam_policy" "admin" {
binding {
role = "roles/editor"
members = [
"user:jane@example.com",
]

View File

@ -3,7 +3,7 @@ layout: "google"
page_title: "Google: google_project_services"
sidebar_current: "docs-google-project-services"
description: |-
Allows management of API services for a Google Cloud Platform project.
Allows management of API services for a Google Cloud Platform project.
---
# google\_project\_services
@ -17,7 +17,7 @@ in the config will be removed.
```js
resource "google_project_services" "project" {
project_id = "your-project-id"
services = ["iam.googleapis.com", "cloudresourcemanager.googleapis.com"]
services = ["iam.googleapis.com", "cloudresourcemanager.googleapis.com"]
}
```

View File

@ -3,7 +3,7 @@ layout: "google"
page_title: "Google: google_service_account"
sidebar_current: "docs-google-service-account"
description: |-
Allows management of a Google Cloud Platform service account.
Allows management of a Google Cloud Platform service account.
---
# google\_service\_account
@ -17,18 +17,19 @@ permission in a project.
```js
resource "google_service_account" "object_viewer" {
account_id = "object-viewer"
display_name = "Object viewer"
account_id = "object-viewer"
display_name = "Object viewer"
}
resource "google_project" "my_project" {
id = "your-project-id"
policy_data = "${data.google_iam_policy.admin.policy_data}"
id = "your-project-id"
policy_data = "${data.google_iam_policy.admin.policy_data}"
}
data "google_iam_policy" "admin" {
binding {
role = "roles/storage.objectViewer"
members = [
"serviceAccount:${google_service_account.object_viewer.email}",
]

View File

@ -24,6 +24,7 @@ resource "google_pubsub_subscription" "default" {
push_config {
endpoint = "https://example.com/push"
attributes {
x-goog-version = "v1"
}

View File

@ -22,7 +22,7 @@ resource "google_storage_bucket" "image-store" {
website {
main_page_suffix = "index.html"
not_found_page = "404.html"
not_found_page = "404.html"
}
}
```

View File

@ -21,7 +21,7 @@ resource "google_storage_bucket" "image-store" {
}
resource "google_storage_bucket_object" "image" {
name = "image1"
name = "image1"
bucket = "${google_storage_bucket.name}"
source = "image1.jpg"
}