From 03518f471b85848c359d8dce2c48fa5f163732c5 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 4 Nov 2020 17:22:34 -0800 Subject: [PATCH] Remove MaxItems validation check on Bigtable instance cluster count (#4166) (#7713) Signed-off-by: Modular Magician --- .changelog/4166.txt | 3 ++ google/resource_bigtable_instance.go | 7 ++-- google/resource_bigtable_instance_test.go | 44 ----------------------- 3 files changed, 5 insertions(+), 49 deletions(-) create mode 100644 .changelog/4166.txt diff --git a/.changelog/4166.txt b/.changelog/4166.txt new file mode 100644 index 00000000000..8ec013c0699 --- /dev/null +++ b/.changelog/4166.txt @@ -0,0 +1,3 @@ +```release-note:none + +``` diff --git a/google/resource_bigtable_instance.go b/google/resource_bigtable_instance.go index 80a729e7774..b0e97985f1d 100644 --- a/google/resource_bigtable_instance.go +++ b/google/resource_bigtable_instance.go @@ -52,7 +52,7 @@ func resourceBigtableInstance() *schema.Resource { Type: schema.TypeList, Optional: true, Computed: true, - Description: `A block of cluster configuration options. This can be specified at least once, and up to 4 times.`, + Description: `A block of cluster configuration options. This can be specified at least once.`, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "cluster_id": { @@ -382,13 +382,10 @@ func expandBigtableClusters(clusters []interface{}, instanceID string) []bigtabl func resourceBigtableInstanceClusterReorderTypeList(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error { oldCount, newCount := diff.GetChange("cluster.#") - // simulate Required:true, MinItems:1, MaxItems:4 for "cluster" + // simulate Required:true, MinItems:1 for "cluster" if newCount.(int) < 1 { return fmt.Errorf("config is invalid: Too few cluster blocks: Should have at least 1 \"cluster\" block") } - if newCount.(int) > 4 { - return fmt.Errorf("config is invalid: Too many cluster blocks: No more than 4 \"cluster\" blocks are allowed") - } // exit early if we're in create (name's old value is nil) n, _ := diff.GetChange("name") diff --git a/google/resource_bigtable_instance_test.go b/google/resource_bigtable_instance_test.go index 61ae1c51de6..3de97c5c338 100644 --- a/google/resource_bigtable_instance_test.go +++ b/google/resource_bigtable_instance_test.go @@ -60,10 +60,6 @@ func TestAccBigtableInstance_cluster(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckBigtableInstanceDestroyProducer(t), Steps: []resource.TestStep{ - { - Config: testAccBigtableInstance_clusterMax(instanceName), - ExpectError: regexp.MustCompile("config is invalid: Too many cluster blocks: No more than 4 \"cluster\" blocks are allowed"), - }, { Config: testAccBigtableInstance_cluster(instanceName, 3), }, @@ -250,46 +246,6 @@ resource "google_bigtable_instance" "instance" { `, instanceName, instanceName, numNodes, instanceName, numNodes, instanceName, numNodes, instanceName, numNodes) } -func testAccBigtableInstance_clusterMax(instanceName string) string { - return fmt.Sprintf(` -resource "google_bigtable_instance" "instance" { - name = "%s" - cluster { - cluster_id = "%s-a" - zone = "us-central1-a" - num_nodes = 3 - storage_type = "HDD" - } - cluster { - cluster_id = "%s-b" - zone = "us-central1-b" - num_nodes = 3 - storage_type = "HDD" - } - cluster { - cluster_id = "%s-c" - zone = "us-central1-c" - num_nodes = 3 - storage_type = "HDD" - } - cluster { - cluster_id = "%s-d" - zone = "us-central1-f" - num_nodes = 3 - storage_type = "HDD" - } - cluster { - cluster_id = "%s-e" - zone = "us-east1-a" - num_nodes = 3 - storage_type = "HDD" - } - - deletion_protection = false -} -`, instanceName, instanceName, instanceName, instanceName, instanceName, instanceName) -} - func testAccBigtableInstance_clusterReordered(instanceName string, numNodes int) string { return fmt.Sprintf(` resource "google_bigtable_instance" "instance" {