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 zone #9318

Closed
wants to merge 1 commit into from
Closed

Conversation

edwardmedia
Copy link
Contributor

Fixes hashicorp/terraform-provider-google#16265

Release Note Template for Downstream PRs (will be copied)

compute: fixed the failure in plan/apply when `zone` is not provided on `google_compute_attached_disk`

@modular-magician
Copy link
Collaborator

Hello! I am a robot. It looks like you are a: Community Contributor Googler Core Contributor. Tests will run automatically.

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

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

Terraform GA: Diff ( 1 file changed, 1 deletion(-))
Terraform Beta: Diff ( 1 file changed, 1 deletion(-))

@@ -38,7 +38,6 @@ func ResourceComputeAttachedDisk() *schema.Resource {

CustomizeDiff: customdiff.All(
tpgresource.DefaultProviderProject,
tpgresource.DefaultProviderZone,
Copy link
Member

Choose a reason for hiding this comment

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

Rather than remove this outright, we likely want a resource-specific version that handles pulling the value out of the instance id. @NickElliot in case you have any thoughts.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, it seems like a pretty straight forward change I could go ahead and takeover if you want @edwardmedia

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rileykarson @NickElliot the issue might be at here https://github.com/hashicorp/terraform-provider-google/blob/a3205a9f9416ac58a0c8e9898a063c7e3181923f/google/tpgresource/utils.go#L793. The value of zone is actually "", not nil in this case during the plan.

Copy link
Member

Choose a reason for hiding this comment

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

I think that line is just checking the resource has a field called zone since ResourceData/ResourceDiff methods will only return nil if a field does not appear in a resource schema! @NickElliot can you confirm? (also, we may want to comment those lines if that's the case since it's nonobvious)

Copy link
Contributor

Choose a reason for hiding this comment

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

correct, if it doesnt exist in schema it returns nil, if it does exist in schema it will return the type-equivalent of nothing aka "" for strings, 0 for ints.

I'll add in the comments with my fix for this

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3163
Passed tests 2844
Skipped tests: 317
Affected tests: 2

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
TestAccBigQueryDataTable_bigtable|TestAccDataSourceGoogleServiceAccountIdToken_impersonation

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

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

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

google_compute_attached_disk failing for zone
4 participants