From 406eecbfe6bc69e7f7dec4745ac7fdbb7766f30d Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 5 Nov 2018 08:45:11 -0800 Subject: [PATCH] google_bigtable_instance add back validation to num_nodes. (#2401) --- google/resource_bigtable_instance.go | 5 +++-- .../docs/r/bigtable_instance.html.markdown | 22 ++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/google/resource_bigtable_instance.go b/google/resource_bigtable_instance.go index 30c303da..aa020815 100644 --- a/google/resource_bigtable_instance.go +++ b/google/resource_bigtable_instance.go @@ -40,8 +40,9 @@ func resourceBigtableInstance() *schema.Resource { Required: true, }, "num_nodes": { - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntAtLeast(3), }, "storage_type": { Type: schema.TypeString, diff --git a/website/docs/r/bigtable_instance.html.markdown b/website/docs/r/bigtable_instance.html.markdown index 99c9dd91..afdf4897 100644 --- a/website/docs/r/bigtable_instance.html.markdown +++ b/website/docs/r/bigtable_instance.html.markdown @@ -13,11 +13,12 @@ Creates a Google Bigtable instance. For more information see [API](https://cloud.google.com/bigtable/docs/go/reference). -## Example Usage +## Example Usage - Production Instance ```hcl -resource "google_bigtable_instance" "instance" { +resource "google_bigtable_instance" "production-instance" { name = "tf-instance" + cluster { cluster_id = "tf-instance-cluster" zone = "us-central1-b" @@ -27,6 +28,21 @@ resource "google_bigtable_instance" "instance" { } ``` +## Example Usage - Development Instance + +```hcl +resource "google_bigtable_instance" "development-instance" { + name = "tf-instance" + instance_type = "DEVELOPMENT" + + cluster { + cluster_id = "tf-instance-cluster" + zone = "us-central1-b" + storage_type = "HDD" + } +} +``` + ## Argument Reference The following arguments are supported: @@ -53,7 +69,7 @@ The `cluster` block supports the following arguments: * `zone` - (Required) The zone to create the Cloud Bigtable cluster in. Each cluster must have a different zone in the same region. Zones that support Bigtable instances are noted on the [Cloud Bigtable locations page](https://cloud.google.com/bigtable/docs/locations). -* `num_nodes` - (Optional) The number of nodes in your Cloud Bigtable cluster. Required, with a minimum of `3` for a `PRODUCTION` instance. Cannot be set for a `DEVELOPMENT` instance. +* `num_nodes` - (Optional) The number of nodes in your Cloud Bigtable cluster. Required, with a minimum of `3` for a `PRODUCTION` instance. Must be left unset for a `DEVELOPMENT` instance. * `storage_type` - (Optional) The storage type to use. One of `"SSD"` or `"HDD"`. Defaults to `"SSD"`.