-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Enable TPUs to use Shared VPC #3939
Enable TPUs to use Shared VPC #3939
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. @megan07, please review this PR or find an appropriate assignee. |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 3 files changed, 104 insertions(+), 30 deletions(-)) |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 3 files changed, 105 insertions(+), 30 deletions(-)) |
Urgh, the google API takes the project name in the network field and holds it as a project number.
|
Tests are passing |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 3 files changed, 112 insertions(+), 32 deletions(-)) |
schedulingConfig: !ruby/object:Overrides::Terraform::PropertyOverride | ||
diff_suppress_func: 'compareTpuNodeSchedulingConfig' | ||
schedulingConfig.preemptible: !ruby/object:Overrides::Terraform::PropertyOverride | ||
diff_suppress_func: 'compareTpuNodeSchedulingConfig' | ||
network: !ruby/object:Overrides::Terraform::PropertyOverride |
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.
This seems to be overwriting the network
block from line 36, and also, I don't think we want to always suppress this diff. What if the intent is to change the network, I don't think it'd recognize the change.
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 thought it was suppressing the values the api returns from get call in the Read function.
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.
Reworked it to check for a change in network.
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'm not sure this will make a huge difference, because if the user really wants to change the network, this will prevent them from doing so. I wonder if we could maybe do a diffsuppress that would parse the network and see if the only difference is the project and then check that the project number is the correct project number? Does that make sense? It's a little hacky, but would be the workaround until the upstream issue was solved.
Also, I think we want to use the diff_suppress_func
from line 38 above rather than creating a new network
block here. Then, in the new diff suppress func that you're implementing, make sure you include the same logic that is in compareSelfLinkOrResourceName
so we don't lose that as well. Does that make sense?
Let me know if you have questions.
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.
Have a look my last commit. How do I get the *Config
in to the diffsupress function? I'm using other functions that expect the config block as arguments.
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.
Hi @upodroid! What a finicky issue! I spent my morning looking into how we can do this. Although diff suppress would be ideal, it looks like we can't use it here. If we want access to config
we'll have to use a CustomizeDiff
.
Basically what I did in the CustomizeDiff was get the old
(value using project number) and new
(value using project name) values, used regex to find the submatch for project. Then called out to the projects API using the project name and if the returned project.Number
was the same as the project number, then i did a diff.SetNew(old)
. Does that make sense? So basically if they're the same project, we're just going to set it to use the project number so there is no diff.
Let me know if you have questions! Thanks again!!
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 amended it to use CustomizeDiff now but i'm still getting diffs.
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.
nvm. It is ready to go.
REDACTED MCW0CDP3YY ~ go … github.com hashicorp terraform-provider-google-beta master 66⬇ 5✎ USAGE $ make testacc TEST=./google-beta TESTARGS='-run=TestAccTPUNode_tpuNodeFullExample'
==> Checking source code against gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test ./google-beta -v -run=TestAccTPUNode_tpuNodeFullExample -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google-beta/version.ProviderVersion=acc"
=== RUN TestAccTPUNode_tpuNodeFullExample
=== PAUSE TestAccTPUNode_tpuNodeFullExample
=== CONT TestAccTPUNode_tpuNodeFullExample
--- PASS: TestAccTPUNode_tpuNodeFullExample (364.17s)
PASS
ok github.com/hashicorp/terraform-provider-google-beta/google-beta 366.543s
It is strange behaviour in the Google API. POST API Call. Missing the network in the API call though.
GET Call after the op is complete.
|
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 3 files changed, 115 insertions(+), 32 deletions(-)) |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 3 files changed, 139 insertions(+), 31 deletions(-)) |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 3 files changed, 136 insertions(+), 30 deletions(-)) |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 3 files changed, 135 insertions(+), 30 deletions(-)) |
/gcbrun |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 3 files changed, 135 insertions(+), 30 deletions(-)) |
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! Thank you!
Fixes: hashicorp/terraform-provider-google#7117
If this PR is for Terraform, I acknowledge that I have:
make test
andmake lint
to ensure it passes unit and linter tests.Release Note Template for Downstream PRs (will be copied)