Skip to content

Commit

Permalink
Minor instance doc update. (#6838) (#4907)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Nov 18, 2022
1 parent c702bbb commit a17f602
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .changelog/6838.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```release-note:none
```
12 changes: 7 additions & 5 deletions google-beta/resource_bigtable_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ func getBigtableZone(z string, config *Config) (string, error) {
func resourceBigtableInstanceClusterReorderTypeList(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error {
oldCount, newCount := diff.GetChange("cluster.#")

// simulate Required:true, MinItems:1 for "cluster"
// Simulate Required:true, MinItems:1 for "cluster". This doesn't work
// when the whole `cluster` field is removed on update.
if newCount.(int) < 1 {
return fmt.Errorf("config is invalid: Too few cluster blocks: Should have at least 1 \"cluster\" block")
}
Expand Down Expand Up @@ -531,10 +532,10 @@ func resourceBigtableInstanceClusterReorderTypeList(_ context.Context, diff *sch
return fmt.Errorf("Error setting cluster diff: %s", err)
}

// Clusters can't have their zone / storage_type updated, ForceNew if it's
// changed. This will show a diff with the old state on the left side and
// the unmodified new state on the right and the ForceNew attributed to the
// _old state index_ even if the diff appears to have moved.
// Clusters can't have their zone, storage_type or kms_key_name updated,
// ForceNew if it's changed. This will show a diff with the old state on
// the left side and the unmodified new state on the right and the ForceNew
// attributed to the _old state index_ even if the diff appears to have moved.
// This depends on the clusters having been reordered already by the prior
// SetNew call.
// We've implemented it here because it doesn't return an error in the
Expand All @@ -545,6 +546,7 @@ func resourceBigtableInstanceClusterReorderTypeList(_ context.Context, diff *sch
continue
}

// ForceNew only if the old and the new clusters have the matching cluster ID.
oZone, nZone := diff.GetChange(fmt.Sprintf("cluster.%d.zone", i))
if oZone != nZone {
err := diff.ForceNew(fmt.Sprintf("cluster.%d.zone", i))
Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/bigtable_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ The following arguments are supported:
* `name` - (Required) The name (also called Instance Id in the Cloud Console) of the Cloud Bigtable instance.

* `cluster` - (Required) A block of cluster configuration options. This can be specified at least once, and up
to as many as possible within 8 cloud regions. See [structure below](#nested_cluster).
to as many as possible within 8 cloud regions. Removing the field entirely from the config will cause the provider
to default to the backend value. See [structure below](#nested_cluster).

-----

Expand Down

0 comments on commit a17f602

Please sign in to comment.