Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set max bigtable instance cluster to 4 #4156

Merged
merged 1 commit into from
Aug 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion google/resource_bigtable_instance.go
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 google/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