-
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
Compute: add support for instance reservation_affinity #4335
Compute: add support for instance reservation_affinity #4335
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. @rileykarson, please review this PR or find an appropriate assignee. |
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.
LGTM so far, running tests. One small comment about the test case formatting (inline)
/gcbrun
func testAccComputeInstance_reservationAffinityConfig(instanceName, reservationType string) string { | ||
var reservationCfg, reservationInstanceCfgSection string | ||
|
||
if reservationType == "SPECIFIC_RESERVATION" { |
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.
Instead of conditional logic, can you duplicate the config so that we've got one for SPECIFIC_RESERVATION and another for the other two cases? Not only is that easier to reason about, it's pretty common for us to copy+paste these configs to debug them or to get a working copy of a resource for a field.
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.
Makes sense. I've split that into two and ditched the branching in both this and the compute_instance_template
resource.
@rileykarson thanks for the review. I've revised the tests as requested and re-run the subset of tests I've added against a local GCP project; all passed. |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 5 files changed, 455 insertions(+), 4 deletions(-)) |
} | ||
|
||
func testAccComputeInstance_reservationAffinity_specificReservationConfig(instanceName string) string { | ||
return ` |
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.
return ` | |
return fmt.Sprintf(` |
I think this is just missing a Sprintf, but it could be more! Mind double checking that this compiles+runs? Thanks!
Relevant test log lines:
go test -timeout=30s $(go list ./...)
# github.com/hashicorp/terraform-provider-google-beta/v3/google-beta
google-beta/resource_compute_instance_test.go:4740:17: expected statement, found ')'
FAIL github.com/hashicorp/terraform-provider-google-beta/v3/google-beta [setup failed]
? github.com/hashicorp/terraform-provider-google-beta/v3 [no test files]
? github.com/hashicorp/terraform-provider-google-beta/v3/scripts/affectedtests [no test files]
? github.com/hashicorp/terraform-provider-google-beta/v3/scripts/sidebar [no test files]
? github.com/hashicorp/terraform-provider-google-beta/v3/version [no test files]
FAIL
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.
Ack. This was indeed just a missing Sprintf
– had it locally as an uncommitted change. Should be good to go now – have verified compilation.
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 5 files changed, 451 insertions(+), 2 deletions(-)) |
What is holding this up from being merged? Is there anything I can do to help? I need this functionality. |
Sorry about the delay here- I lost track of this PR, likely accidentally dismissing the notification email while cleaning my inbox out. @mhuxtable: Would you be able to rebase it? It looks like some conflicts have popped up since I last took a look. I'll clone and complete it otherwise. |
reservation_affinity controls how instances or instances created from templates consume Compute Engine resource reservations. Closes GoogleCloudPlatform#4593
2246bf4
to
29e262d
Compare
I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=189477" |
@rileykarson that's done and the tests re-run. |
I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccComputeInstanceTemplate_reservationAffinities|TestAccComputeInstance_reservationAffinities You can view the result here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=189478" |
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.
LGTM, thanks!
reservation_affinity controls how instances or instances created from
templates consume Compute Engine resource reservations.
Fixes hashicorp/terraform-provider-google#4593
This hoists my PR from hashicorp/terraform-provider-google#7669 up to magic-modules so this effort is not on someone else to do.
If this PR is for Terraform, I acknowledge that I have:
make test
andmake lint
to ensure it passes unit and linter tests. – I ran the subset of tests relating to added functionalityRelease Note Template for Downstream PRs (will be copied)