diff --git a/build/terraform b/build/terraform index 98fc44249534..d678d7b5ead6 160000 --- a/build/terraform +++ b/build/terraform @@ -1 +1 @@ -Subproject commit 98fc4424953489e65373fef7e0d75ff97bc05711 +Subproject commit d678d7b5ead691d62174100cdd08c2501187a5a6 diff --git a/build/terraform-beta b/build/terraform-beta index 7fad3c22848d..34f73a899d56 160000 --- a/build/terraform-beta +++ b/build/terraform-beta @@ -1 +1 @@ -Subproject commit 7fad3c22848db106f6b25867566dacd1ee7caf7b +Subproject commit 34f73a899d56d5d182644488b3089f87c5905cf5 diff --git a/third_party/terraform/resources/resource_bigtable_instance.go b/third_party/terraform/resources/resource_bigtable_instance.go index 1d30ac2e2d18..ed1435b54d5b 100644 --- a/third_party/terraform/resources/resource_bigtable_instance.go +++ b/third_party/terraform/resources/resource_bigtable_instance.go @@ -28,7 +28,7 @@ func resourceBigtableInstance() *schema.Resource { Type: schema.TypeSet, Required: true, ForceNew: true, - MaxItems: 2, + MaxItems: 4, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "cluster_id": { diff --git a/third_party/terraform/tests/resource_bigtable_instance_test.go b/third_party/terraform/tests/resource_bigtable_instance_test.go index cf878307a332..d3bb9d69cc40 100644 --- a/third_party/terraform/tests/resource_bigtable_instance_test.go +++ b/third_party/terraform/tests/resource_bigtable_instance_test.go @@ -3,6 +3,7 @@ package google import ( "context" "fmt" + "regexp" "testing" "github.com/hashicorp/terraform/helper/acctest" @@ -48,6 +49,10 @@ func TestAccBigtableInstance_cluster(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckBigtableInstanceDestroy, 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), Check: resource.ComposeTestCheckFunc( @@ -152,18 +157,68 @@ 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" + } +} +`, instanceName, instanceName, instanceName, instanceName, instanceName) +} + +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" + } } -`, instanceName, instanceName, instanceName) +`, instanceName, instanceName, instanceName, instanceName, instanceName, instanceName) } func testAccBigtableInstance_development(instanceName string) string {