-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add support for auto_healing_policies to google_compute_instance_group_manager #198
Conversation
…pport (#129) * Refactor resource_compute_instance_group_manager for multi version support. * Minor changes based on review. * Removed type-specific API version conversion functions.
…sion resources don't see diffs.
Merge master into beta-resources
Assuming this is just merging that branch into master with all the different changes I've reviewed, I'm ok with this. However, since it's a pretty big infrastructure change, it may be worth it to check in slack whether anyone from HashiCorp wants to review it first or whether they're ok with our judgment. |
case ComputeBetaOperationWaitZone: | ||
op, err = w.Service.ZoneOperations.Get( | ||
w.Project, w.Zone, w.Op.Name).Do() | ||
default: |
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.
In the default case, should we consider the operation type "unknown" rather than "invalid"? And then update the error message to something like "Unknown wait condition %#v encountered. ComputeBetaOperationWaiter should be updated by maintainers to include this new operation type." or something?
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.
ComputeBetaOperation
is a copy of the existing ComputeOperation
where we sub compute/v0beta
's Operation
type for compute/v1
's Operation
type. These changes would also need to be applied to compute_operation.go
as well as compute_beta_operation.go
. and I don't think that kind of change makes sense in the context of this PR.
Improving Operations is something that I've been thinking about with #187, which would introduce a standard Operation
type for all versioned compute resources (such as storing them all as v1
Operations), and a refactoring of compute_operation.go
that was pulled into #191.
func (e ComputeBetaOperationError) Error() string { | ||
var buf bytes.Buffer | ||
|
||
for _, err := range e.Errors { |
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.
If the ComputeBetaOperationError
has multiple errors, and any of the errors have a newline in the message, it will be hard to differentiate them. Maybe take the index of the range and prefix it to the buffer?
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.
See above. If it's something you think would be valuable for compute_operation.go
as well, feel free to comment with it on #191.
@@ -0,0 +1,99 @@ | |||
package google |
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.
Need license header
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.
Are license headers something that we include in any of these files? Looking over provider.go
, config.go
, and a few resources, I can't see one included elsewhere.
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.
Ahh, I guess not. But we should. I'll file an issue.
return fmt.Errorf("Error waiting for %s: %s", activity, err) | ||
} | ||
|
||
op = opRaw.(*computeBeta.Operation) |
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.
Worth checking that the type assertion succeeds here? Like op, ok := opRaw.(...)
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.
See above.
} | ||
|
||
func computeBetaOperationWaitZone(config *Config, op *computeBeta.Operation, project string, zone, activity string) error { | ||
return computeBetaOperationWaitZoneTime(config, op, project, zone, 4, activity) |
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.
Should we make the time vars more configurable/obvious?
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.
See above. If we want to expose a better interface, that's something we should consider for #191.
return nil | ||
} | ||
|
||
func computeBetaOperationWaitZone(config *Config, op *computeBeta.Operation, project string, zone, activity string) error { |
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.
project, zone, activity string
(remove the string
after project)
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.
See above/changes made in #191.
Type: ComputeBetaOperationWaitZone, | ||
} | ||
state := w.Conf() | ||
state.Delay = 10 * time.Second |
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.
See previous about configuring timeouts in one place.
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.
} | ||
|
||
func computeSharedOperationWaitZoneTime(config *Config, op interface{}, project string, zone string, minutes int, activity string) error { | ||
if op == nil { |
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.
nil check shouldn't be necessary as the type switch's default
will catch it.
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.
Added a nil
check as a case in #234 instead of having it at the top.
Closing this PR in favour of splitting it in 2, adding Beta support to |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Add support for
auto_healing_policies
togoogle_compute_instance_group_manager
; Fixes #48Add support for a beta GCP feature to a Google Provider resource; part of #93
Terraform manages
v0beta
andv0alpha
Compute resources by using non-v1
APIs to create and manage resources when necessary, automatically using the most restrictive API it can. Users don't need to think about what version they are using, or perform complicated operations to manage their state files.For reviewing, the best way to view the merge changes is by filtering for only the last two commits in the change view; Github is able to show just those changes and hides the merged commits.