diff --git a/mmv1/third_party/terraform/resources/resource_bigtable_instance.go b/mmv1/third_party/terraform/resources/resource_bigtable_instance.go index 2029e113e7cd..2df24a6b682a 100644 --- a/mmv1/third_party/terraform/resources/resource_bigtable_instance.go +++ b/mmv1/third_party/terraform/resources/resource_bigtable_instance.go @@ -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") } @@ -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 @@ -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)) diff --git a/mmv1/third_party/terraform/website/docs/r/bigtable_instance.html.markdown b/mmv1/third_party/terraform/website/docs/r/bigtable_instance.html.markdown index 47829c87c487..94d916d49a6a 100644 --- a/mmv1/third_party/terraform/website/docs/r/bigtable_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/bigtable_instance.html.markdown @@ -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). -----