Skip to content

Commit

Permalink
Fix issue with Bigtable instance cluster update at 2.0.0 (#2584)
Browse files Browse the repository at this point in the history
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
  • Loading branch information
modular-magician authored and rileykarson committed Dec 5, 2018
1 parent 1b3c784 commit 2afc653
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions google/resource_bigtable_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,24 @@ func resourceBigtableInstance() *schema.Resource {
"cluster_id": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"zone": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"num_nodes": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
ValidateFunc: validation.IntAtLeast(3),
},
"storage_type": {
Type: schema.TypeString,
Optional: true,
Default: "SSD",
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"SSD", "HDD"}, false),
},
},
Expand Down
15 changes: 11 additions & 4 deletions google/resource_bigtable_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ func TestAccBigtableInstance_basic(t *testing.T) {
CheckDestroy: testAccCheckBigtableInstanceDestroy,
Steps: []resource.TestStep{
{
Config: testAccBigtableInstance(instanceName),
Config: testAccBigtableInstance(instanceName, 3),
Check: resource.ComposeTestCheckFunc(
testAccBigtableInstanceExists(
"google_bigtable_instance.instance"),
),
},
{
Config: testAccBigtableInstance(instanceName, 4),
Check: resource.ComposeTestCheckFunc(
testAccBigtableInstanceExists(
"google_bigtable_instance.instance"),
Expand Down Expand Up @@ -125,18 +132,18 @@ func testAccBigtableInstanceExists(n string) resource.TestCheckFunc {
}
}

func testAccBigtableInstance(instanceName string) string {
func testAccBigtableInstance(instanceName string, numNodes int) string {
return fmt.Sprintf(`
resource "google_bigtable_instance" "instance" {
name = "%s"
cluster {
cluster_id = "%s"
zone = "us-central1-b"
num_nodes = 3
num_nodes = %d
storage_type = "HDD"
}
}
`, instanceName, instanceName)
`, instanceName, instanceName, numNodes)
}

func testAccBigtableInstance_cluster(instanceName string) string {
Expand Down

0 comments on commit 2afc653

Please sign in to comment.