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

TF: plan -refresh=false for google_compute_ha_vpn_gateway with gcs backend has resource replacement #12422

Merged
merged 3 commits into from
Dec 12, 2024

Conversation

akshat-jindal-nit
Copy link
Contributor

@akshat-jindal-nit akshat-jindal-nit commented Nov 25, 2024

Bug: b/376368181
Issue: hashicorp/terraform-provider-google#19978
This particular change is the main culprit of this issue https://screenshot.googleplex.com/79xwUXBEcc5SYAg.
Looks like this issue start occurring from the release v5.40.0 https://screenshot.googleplex.com/367U6wou3dHnzaJ.

Release Note Template for Downstream PRs (will be copied)

bug: fixed an issue where `terraform plan -refresh=false` with `google_compute_ha_vpn_gateway.gateway_ip_version` would plan a resource replacement if a full refresh had not been run yet. Terraform now assumes that the value is the default value, `IPV4`, until a refresh is completed.

Copy link

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

@rileykarson, 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.

@github-actions github-actions bot requested a review from rileykarson November 25, 2024 09:50
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Nov 25, 2024
@harshithpatte-g
Copy link
Contributor

@akshat-jindal-nit can repro this issue with a test? Could we add that test?

@akshat-jindal-nit
Copy link
Contributor Author

@akshat-jindal-nit can repro this issue with a test? Could we add that test?

@harshithpatte-g this particular change is related to terraform plan -refresh=false related changes. I think we don't write any particulars tests for it.
But this TestAccDataSourceComputeHaVpnGateway is running successfully as our changes are intended to impact the default_values only .

Copy link

@rileykarson 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

github-actions bot commented Dec 2, 2024

@GoogleCloudPlatform/terraform-team @rileykarson This PR has been waiting for review for 1 week. Please take a look! Use the label disable-review-reminders to disable these notifications.

@modular-magician modular-magician added service/compute-vpn and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Dec 2, 2024
@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 ( 1 file changed, 4 deletions(-))
google-beta provider: Diff ( 1 file changed, 4 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1069
Passed tests: 996
Skipped tests: 73
Affected tests: 0

Click here to see the affected service packages
  • compute

🟢 All tests passed!

View the build log

Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

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

Were you able to test manually to confirm the fix? I'm a bit confused why this works, because we're removing what is traditionally the mitigation for the issue here.

@akshat-jindal-nit
Copy link
Contributor Author

Were you able to test manually to confirm the fix? I'm a bit confused why this works, because we're removing what is traditionally the mitigation for the issue here.

Yes I test it manually and this particular change is fixing this particular issue.

@github-actions github-actions bot requested a review from rileykarson December 3, 2024 05:04
Copy link

github-actions bot commented Dec 5, 2024

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

@rileykarson
Copy link
Member

Sorry, could you elaborate on how you've reproduced the issue? I continue to see it both before and after this change. Effectively, we assume that a refresh is performed after the upgrade- we'd resolve that with a StateUpgrader to infill the default value where it's null (but really, a full refresh would be better in case the live value is different).

@akshat-jindal-nit
Copy link
Contributor Author

StateUpgrader

I perform these steps to reproduce the issue b/37636818

  1. make a module with the 1st configuration (provider v5.16.0)
  2. terraform init
  3. terraform apply
  4. change google provider version to v5.44.2
  5. rm -f .terraform.lock.hcl
  6. terraform init
  7. terraform plan -refresh=false <--- the issue occurrs here
  8. terraform plan <--- doesn't have changes
  9. terraform apply <--- doesn't make any changes

By removing the defaulting logic, the fixed version of the function ensures that Terraform accurately reflects the actual state of the gateway_ip_version attribute in Google Cloud. This prevents the false positive change detection and avoids unnecessary resource replacements.

Copy link

github-actions bot commented Dec 9, 2024

@GoogleCloudPlatform/terraform-team @rileykarson This PR has been waiting for review for 1 week. Please take a look! Use the label disable-review-reminders to disable these notifications.

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Dec 11, 2024
@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Dec 11, 2024
@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 ( 1 file changed, 118 insertions(+))
google-beta provider: Diff ( 1 file changed, 118 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1073
Passed tests: 1000
Skipped tests: 73
Affected tests: 0

Click here to see the affected service packages
  • compute

🟢 All tests passed!

View the build log

@github-actions github-actions bot requested a review from rileykarson December 12, 2024 05:41
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Dec 12, 2024
Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

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

The code looks good and this works on my machine to solve the original bug- just waiting for generate + test to LGTM and merge.

@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Dec 12, 2024
@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 ( 1 file changed, 129 insertions(+))
google-beta provider: Diff ( 1 file changed, 129 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1073
Passed tests: 1000
Skipped tests: 73
Affected tests: 0

Click here to see the affected service packages
  • compute

🟢 All tests passed!

View the build log

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.

4 participants