Skip to content
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

Show diff for computed nested labels fields #10393

Closed

Conversation

zli82016
Copy link
Member

@zli82016 zli82016 commented Apr 9, 2024

Resource google_cloud_run_service and google_cloud_run_domain_mapping have nested labels fields metadata.0.labels and metadata.0.annotations.

In the CustomizeDiff function SetMetadataLabelsDiff, SetNew is applied on "metadata" field with the object including terraform_labels and effective_labels. It introduced two bugs.

  1. when creating resource, computed metadata.0.labels and metadata.0.annotations fields don't appear in terraform plan
  2. After creating the resource with the normal labels value, and then updating the labels fields with the computed value will fail, similar to root labels field Error: Provider produced inconsistent final plan - "registry.terraform.io/hashicorp/google" produced an invalid new value for .terraform_labels: new element "date_modified" has appeared. hashicorp/terraform-provider-google#16217.
    This bug cannot be fixed with the similar way in Fix the bug for computed labels and annotations #10182.
    The reason is that metadata.0.terraform_labels and metadat.0.effective_labels fields cannot be set to computed due to a bug that SetNew doesn't work on nested fields
    in terraform sdk SetNew does not work on nested fields hashicorp/terraform-plugin-sdk#459

These two bugs can be fixed by moving terraform_labels and effective_labels to root level in provider release 6.0.
Before the release 6.0, the first bug can be fixed in this PR and I don't find an easy way to fix the second bug.

Release Note Template for Downstream PRs (will be copied)

cloudrun: fixed the bug that computed `metadata.0.labels` and `metadata.0.annotations` fields don't appear in terraform plan when creating resource `google_cloud_run_service` and `google_cloud_run_domain_mapping`

@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 ( 3 files changed, 81 insertions(+))
google-beta provider: Diff ( 3 files changed, 81 insertions(+))

@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 ( 3 files changed, 87 insertions(+))
google-beta provider: Diff ( 3 files changed, 87 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2726
Passed tests: 2369
Skipped tests: 354
Affected tests: 3

Click here to see the affected service packages
all service packages are affected

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccCloudRunService_withComputedLabels|TestAccKMSEkmConnection_kmsEkmConnectionBasicExample_update|TestAccSqlUser_postgresIAM

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccCloudRunService_withComputedLabels[Debug log]
TestAccKMSEkmConnection_kmsEkmConnectionBasicExample_update[Debug log]

$\textcolor{red}{\textsf{Tests failed when rerunning REPLAYING mode:}}$
TestAccCloudRunService_withComputedLabels[Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccSqlUser_postgresIAM[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@zli82016 zli82016 closed this Apr 9, 2024
@zli82016 zli82016 deleted the computed-nested-labels branch April 9, 2024 19:29
@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2934
Passed tests: 2576
Skipped tests: 356
Affected tests: 2

Click here to see the affected service packages
all service packages are affected

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccCloudRunService_withComputedLabels|TestAccSqlUser_postgresIAM

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccCloudRunService_withComputedLabels[Debug log]

$\textcolor{red}{\textsf{Tests failed when rerunning REPLAYING mode:}}$
TestAccCloudRunService_withComputedLabels[Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccSqlUser_postgresIAM[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

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.

2 participants