-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add labels to Bigtable instance #3793
Add labels to Bigtable instance #3793
Conversation
Hello! I am a robot who works on Magic Modules PRs. I have detected that you are a community contributor, so your PR will be assigned to someone with a commit-bit on this repo for initial review. Thanks for your contribution! A human will be with you soon. @danawillow, please review this PR or find an appropriate assignee. |
The generated code for this doesn't build. I assume there's a go module that would need to be updated in TPG/TPGB first to get a version of the client libraries that supports labels. Error message:
|
Thanks @danawillow |
Oops! It looks like no changelog entry is attached to this PR. Please include a release note block in the PR body, as described in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md:
|
Tests are failing:
|
1c5de35
to
05f8f20
Compare
@danawillow Should be all good now. Thanks. |
@@ -242,6 +254,10 @@ func resourceBigtableInstanceUpdate(d *schema.ResourceData, meta interface{}) er | |||
} | |||
conf.DisplayName = displayName.(string) | |||
|
|||
if _, ok := d.GetOk("labels"); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this if statement needs to be removed to allow removing all labels. See this test failure:
------- Stdout: -------
=== RUN TestAccBigtableInstance_cluster
=== PAUSE TestAccBigtableInstance_cluster
=== CONT TestAccBigtableInstance_cluster
TestAccBigtableInstance_cluster: testing.go:674: Step 7 error: After applying this step, the plan was not empty:
DIFF:
UPDATE: google_bigtable_instance.instance
cluster.#: "4" => "4"
cluster.0.cluster_id: "tf-test-14k76bhjh4-a" => "tf-test-14k76bhjh4-a"
cluster.0.num_nodes: "5" => "5"
cluster.0.storage_type: "HDD" => "HDD"
cluster.0.zone: "us-central1-a" => "us-central1-a"
cluster.1.cluster_id: "tf-test-14k76bhjh4-c" => "tf-test-14k76bhjh4-c"
cluster.1.num_nodes: "5" => "5"
cluster.1.storage_type: "HDD" => "HDD"
cluster.1.zone: "us-central1-c" => "us-central1-c"
cluster.2.cluster_id: "tf-test-14k76bhjh4-b" => "tf-test-14k76bhjh4-b"
cluster.2.num_nodes: "5" => "5"
cluster.2.storage_type: "HDD" => "HDD"
cluster.2.zone: "us-central1-b" => "us-central1-b"
cluster.3.cluster_id: "tf-test-14k76bhjh4-d" => "tf-test-14k76bhjh4-d"
cluster.3.num_nodes: "5" => "5"
cluster.3.storage_type: "HDD" => "HDD"
cluster.3.zone: "us-central1-f" => "us-central1-f"
deletion_protection: "false" => "false"
display_name: "tf-test-14k76bhjh4" => "tf-test-14k76bhjh4"
id: "projects/ci-test-project-188019/instances/tf-test-14k76bhjh4" => "projects/ci-test-project-188019/instances/tf-test-14k76bhjh4"
instance_type: "PRODUCTION" => "PRODUCTION"
labels.env: "default" => ""
name: "tf-test-14k76bhjh4" => "tf-test-14k76bhjh4"
project: "ci-test-project-188019" => "ci-test-project-188019"
STATE:
google_bigtable_instance.instance:
ID = projects/ci-test-project-188019/instances/tf-test-14k76bhjh4
provider = provider.google
cluster.# = 4
cluster.0.cluster_id = tf-test-14k76bhjh4-a
cluster.0.num_nodes = 5
cluster.0.storage_type = HDD
cluster.0.zone = us-central1-a
cluster.1.cluster_id = tf-test-14k76bhjh4-c
cluster.1.num_nodes = 5
cluster.1.storage_type = HDD
cluster.1.zone = us-central1-c
cluster.2.cluster_id = tf-test-14k76bhjh4-b
cluster.2.num_nodes = 5
cluster.2.storage_type = HDD
cluster.2.zone = us-central1-b
cluster.3.cluster_id = tf-test-14k76bhjh4-d
cluster.3.num_nodes = 5
cluster.3.storage_type = HDD
cluster.3.zone = us-central1-f
deletion_protection = false
display_name = tf-test-14k76bhjh4
instance_type = PRODUCTION
labels.env = default
name = tf-test-14k76bhjh4
project = ci-test-project-188019
--- FAIL: TestAccBigtableInstance_cluster (51.96s)
FAIL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danawillow I've changed the if-GetOk clause to if-HasChange. I reckon that should have fixed the update call.
if d.HasChange("labels") {
conf.Labels = expandLabels(d)
}
Add labels to Bigtable instance
05f8f20
to
9bbecfd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks @ryanyuan!
Fix hashicorp/terraform-provider-google#6813
Release Note Template for Downstream PRs (will be copied)