Skip to content

Commit

Permalink
set max bigtable instance cluster to 4 (#2121)
Browse files Browse the repository at this point in the history
Merged PR #2121.
  • Loading branch information
megan07 authored and modular-magician committed Aug 5, 2019
1 parent bb4c89a commit 20dc552
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
57 changes: 56 additions & 1 deletion third_party/terraform/tests/resource_bigtable_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package google
import (
"context"
"fmt"
"regexp"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 20dc552

Please sign in to comment.