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

Fix google_dns_managed_zone update #12934

Merged
merged 4 commits into from
Feb 5, 2025

Conversation

shuyama1
Copy link
Member

@shuyama1 shuyama1 commented Jan 31, 2025

fixes b/372460202

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

dns: fixed a bug where `google_dns_managed_zone` is unable to update with `service_directory_config` specified

@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-beta provider: Diff ( 1 file changed, 124 insertions(+), 16 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

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

Click here to see the affected service packages
  • dns

🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR.

View the build log

@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-beta provider: Diff ( 1 file changed, 124 insertions(+), 16 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

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

Click here to see the affected service packages
  • dns

🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR.

View the build log

@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-beta provider: Diff ( 1 file changed, 108 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 48
Passed tests: 46
Skipped tests: 1
Affected tests: 1

Click here to see the affected service packages
  • dns

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccDNSManagedZone_dnsManagedZoneUpdateWithServiceDirectory

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🔴 Tests failed during RECORDING mode:
TestAccDNSManagedZone_dnsManagedZoneUpdateWithServiceDirectory [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@shuyama1
Copy link
Member Author

🔴 Tests failed during RECORDING mode: TestAccDNSManagedZone_dnsManagedZoneUpdateWithServiceDirectory [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

This failure is expected prior to the fix.

@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-beta provider: Diff ( 2 files changed, 109 insertions(+), 1 deletion(-))
terraform-google-conversion: Diff ( 1 file changed, 1 insertion(+), 1 deletion(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 48
Passed tests: 45
Skipped tests: 1
Affected tests: 2

Click here to see the affected service packages
  • dns

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
  • TestAccDNSManagedZone_dnsManagedZoneServiceDirectoryExample
  • TestAccDNSManagedZone_dnsManagedZoneUpdateWithServiceDirectory

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccDNSManagedZone_dnsManagedZoneServiceDirectoryExample [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccDNSManagedZone_dnsManagedZoneUpdateWithServiceDirectory [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@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-beta provider: Diff ( 2 files changed, 109 insertions(+), 1 deletion(-))
terraform-google-conversion: Diff ( 1 file changed, 1 insertion(+), 1 deletion(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 48
Passed tests: 46
Skipped tests: 1
Affected tests: 1

Click here to see the affected service packages
  • dns

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccDNSManagedZone_dnsManagedZoneUpdateWithServiceDirectory

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccDNSManagedZone_dnsManagedZoneUpdateWithServiceDirectory [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

@@ -4,7 +4,7 @@ func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.T
} else if strings.HasPrefix(v.(string), "https://") {
return v, nil
}
url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ServiceDirectoryBasePath{{"}}"}}" + v.(string))
url, err := tpgresource.ReplaceVars(d, config, "https://servicedirectory.googleapis.com/v1/" + v.(string))
Copy link
Member Author

Choose a reason for hiding this comment

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

Confirmed by service team member @erikmej-code, https://servicedirectory.googleapis.com/v1/ is always used even if v1beta is explicitly sent

Copy link
Member

Choose a reason for hiding this comment

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

can we comment that in the code itself?

@shuyama1 shuyama1 requested a review from c2thorn February 4, 2025 20:04
@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-beta provider: Diff ( 2 files changed, 110 insertions(+), 1 deletion(-))
terraform-google-conversion: Diff ( 1 file changed, 2 insertions(+), 1 deletion(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 48
Passed tests: 47
Skipped tests: 1
Affected tests: 0

Click here to see the affected service packages
  • dns

🟢 All tests passed!

View the build log

@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-beta provider: Diff ( 2 files changed, 110 insertions(+), 1 deletion(-))
terraform-google-conversion: Diff ( 1 file changed, 2 insertions(+), 1 deletion(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 48
Passed tests: 47
Skipped tests: 1
Affected tests: 0

Click here to see the affected service packages
  • dns

🟢 All tests passed!

View the build log

@@ -4,7 +4,8 @@ func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.T
} else if strings.HasPrefix(v.(string), "https://") {
return v, nil
}
url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ServiceDirectoryBasePath{{"}}"}}" + v.(string))
// v1 is the only version in use
url, err := tpgresource.ReplaceVars(d, config, "https://servicedirectory.googleapis.com/v1/" + v.(string))
Copy link
Member

Choose a reason for hiding this comment

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

Could we substitute v1 for beta specifically or confirm this service isn't in alternate universes rather than providing a fixed URL here? Fixed URLs are mostly unsafe to use in checks nowadays, unfortunately!

Copy link
Member

Choose a reason for hiding this comment

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

Good point. It's necessary to do a substitution after the fact so we capture BasePath changes that have been applied before this code runs.

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe substituting v1 for beta should be working in this case, I assume you mean something similarly to https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/tpgresource/self_link_helpers.go#L95. Yeah, that's safer than using fixed URLs

Copy link
Member

Choose a reason for hiding this comment

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

This approach works in GCP! I meant a substring replacement of v1 for beta rather than a fixed URL prefix like we're currently doing*

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I'll revert this change and create a new one

Copy link
Member

Choose a reason for hiding this comment

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

Thanks! Sorry 😅

@c2thorn we may want to add a lint rule against fixed GCP URLs appearing in the provider outside of the specific spots they're safe to appear

Copy link
Member

Choose a reason for hiding this comment

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

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