Skip to content

Conversation

@BrandonCate
Copy link
Contributor

@BrandonCate BrandonCate commented Sep 10, 2025

Allow new clusters to be added without forcing new instance

Following Resource is effected:

  • resource_bigtable_instance

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

bigtable: fixed `node_scaling_factor` forcing new instance on `google_bigtable_instance` when adding new cluster

Context:

Related Github Issue: hashicorp/terraform-provider-google#23564

TLDR; When adding a new cluster to an existing bigtable instance a forced recreate is required due to the forceNew attribute on node_scaling_factor. This doesn't match the API / Console functionality where adding a new cluster requires no recreate.

This PR removes the unconditional forceNew attribute on node_scaling_factor and instead adds to the CustomizeDiff to check if an existing cluster's node_scaling_factor has changed or not. If yes; require recreate. If no; don't require recreate.

Testing:

I've added two new test cases.

  1. Test modifying existing cluster's node_scaling_factor and fails when deletion_protection is true
  2. Test adding a new cluster to an existing instance AND does not require deletion/recreate.

I've run these test in local env, sample logs below

brandon.cate@DD944JY0FF terraform-provider-google-beta % make testacc TEST=./google-beta/services/bigtable TESTARGS='-run=TestAccBigtableInstance_addNewClusterWithoutDeletionProtection$$'
==> Checking that code complies with gofmt requirements...
go vet
TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test ./google-beta/services/bigtable -v -run=TestAccBigtableInstance_addNewClusterWithoutDeletionProtection$ -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google-beta/version.ProviderVersion=acc"
=== RUN   TestAccBigtableInstance_addNewClusterWithoutDeletionProtection
=== PAUSE TestAccBigtableInstance_addNewClusterWithoutDeletionProtection
=== CONT  TestAccBigtableInstance_addNewClusterWithoutDeletionProtection
--- PASS: TestAccBigtableInstance_addNewClusterWithoutDeletionProtection (45.62s)
PASS
ok      github.com/hashicorp/terraform-provider-google-beta/google-beta/services/bigtable       46.799s


brandon.cate@DD944JY0FF terraform-provider-google-beta % make testacc TEST=./google-beta/services/bigtable TESTARGS='-run=TestAccBigtableInstance_createWithNodeScalingFactorThenFailFromDeletionProtection$$'
==> Checking that code complies with gofmt requirements...
go vet
TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test ./google-beta/services/bigtable -v -run=TestAccBigtableInstance_createWithNodeScalingFactorThenFailFromDeletionProtection$ -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google-beta/version.ProviderVersion=acc"
=== RUN   TestAccBigtableInstance_createWithNodeScalingFactorThenFailFromDeletionProtection
=== PAUSE TestAccBigtableInstance_createWithNodeScalingFactorThenFailFromDeletionProtection
=== CONT  TestAccBigtableInstance_createWithNodeScalingFactorThenFailFromDeletionProtection
--- PASS: TestAccBigtableInstance_createWithNodeScalingFactorThenFailFromDeletionProtection (27.52s)
PASS
ok      github.com/hashicorp/terraform-provider-google-beta/google-beta/services/bigtable       28.493s

Sorry for not opening as draft!

@google-cla
Copy link

google-cla bot commented Sep 10, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions
Copy link

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@ScottSuarez, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

@ScottSuarez ScottSuarez marked this pull request as draft September 10, 2025 20:37
@BrandonCate BrandonCate changed the title TESTING PR IGNORE - will open new when ready BigTable - NodeScalingFactor Force New BugFix Sep 11, 2025
@BrandonCate BrandonCate marked this pull request as ready for review September 11, 2025 17:15
@github-actions
Copy link

@ScottSuarez This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

Copy link
Contributor

@ScottSuarez ScottSuarez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable. Small ask on comment revision.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 2 files changed, 148 insertions(+), 7 deletions(-))
google-beta provider: Diff ( 2 files changed, 148 insertions(+), 7 deletions(-))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_bigtable_instance (125 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_bigtable_instance" "primary" {
  cluster {
    node_scaling_factor = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Non-exercised tests

🔴 Tests were added that are skipped in VCR:

  • TestAccBigtableInstance_addNewClusterWithoutDeletionProtection
  • TestAccBigtableInstance_createWithNodeScalingFactorThenFailFromDeletionProtection

Tests analytics

Total tests: 63
Passed tests: 0
Skipped tests: 63
Affected tests: 0

Click here to see the affected service packages
  • bigtable

🟢 All tests passed!

View the build log

@ScottSuarez ScottSuarez added this pull request to the merge queue Sep 18, 2025
@ScottSuarez
Copy link
Contributor

not blocking on the deletion ask as it's not relevant to current change

Merged via the queue into GoogleCloudPlatform:main with commit 23a2acd Sep 18, 2025
34 checks passed
sahil-mahajan-google pushed a commit to sahil-mahajan-google/magic-modules that referenced this pull request Sep 19, 2025
BBBmau pushed a commit to BBBmau/magic-modules that referenced this pull request Sep 26, 2025
jkrish-c pushed a commit to jkrish-c/magic-modules that referenced this pull request Oct 14, 2025
BBBmau pushed a commit to BBBmau/magic-modules that referenced this pull request Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants