Skip to content

Commit

Permalink
Minor instance doc update. (GoogleCloudPlatform#6838)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsi4508 authored and hao-nan-li committed Dec 6, 2022
1 parent 0f68add commit 7a2ba67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
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
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 7a2ba67

Please sign in to comment.