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

handle case where bigtable development instances have one node #5557

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
3 changes: 3 additions & 0 deletions .changelog/3057.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
bigtable: fixed diff for DEVELOPMENT instances that are returned from the API with one node
```
9 changes: 6 additions & 3 deletions google/resource_bigtable_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ func resourceBigtableInstance() *schema.Resource {
Required: true,
},
"num_nodes": {
Type: schema.TypeInt,
Optional: true,
Type: schema.TypeInt,
Optional: true,
// DEVELOPMENT instances could get returned with either zero or one node,
// so mark as computed.
Computed: true,
ValidateFunc: validation.IntAtLeast(3),
},
"storage_type": {
Expand Down Expand Up @@ -311,7 +314,7 @@ func resourceBigtableInstanceValidateDevelopment(diff *schema.ResourceDiff, meta
if diff.Get("cluster.#").(int) != 1 {
return fmt.Errorf("config is invalid: instance with instance_type=\"DEVELOPMENT\" should have exactly one \"cluster\" block")
}
if diff.Get("cluster.0.num_nodes").(int) != 0 {
if diff.Get("cluster.0.num_nodes").(int) > 1 {
return fmt.Errorf("config is invalid: num_nodes cannot be set for instance_type=\"DEVELOPMENT\"")
}
return nil
Expand Down
1 change: 1 addition & 0 deletions google/resource_sql_database_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"

sqladmin "google.golang.org/api/sqladmin/v1beta4"
)

Expand Down