Add instance group manager bulk per instance config resource.#18017
Add instance group manager bulk per instance config resource.#18017pjotrekk wants to merge 1 commit into
Conversation
|
Googlers: For automatic test runs see go/terraform-auto-test-runs. @zli82016, 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. |
| return map[string]*schema.Schema{ | ||
| "name": { | ||
| Type: schema.TypeString, | ||
| OptionalForImport: true, |
There was a problem hiding this comment.
I think we should disable importing
There was a problem hiding this comment.
Removed OptionalForImport
There was a problem hiding this comment.
Sorry, couldn't remove it after all because I'd have to delete the whole identity object where igm is set. Maybe it's ok to remove it but I'm not able to finish it before vacation
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit aca9f7f: Diff reportYour PR generated the following diffs in downstream repositories:
Missing test reportYour PR includes resource fields which are not covered by any test. Resource: resource "google_compute_bulk_per_instance_config" "primary" {
zone = # value needed
}
Missing service labelsThe following new resources do not have corresponding service labels:
If you believe this detection to be incorrect please raise the concern with your reviewer. Googlers: This error is safe to ignore once you've completed go/fix-missing-service-labels. Test reportImportant Manual Verification Required VCR cannot automatically execute the following tests added in this PR. Please verify them manually: 🔴 TestAccComputeBulkPerInstanceConfig_allInstancesChanged Analytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 1389 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. More than 100 tests failed in replaying; this is too many to display on GitHub. View the Cloud Build logs to see the full list. View the replaying VCR build log Step 2: Recording Mode More than 100 tests ran in recording mode; this is too many to display on GitHub. View the Cloud Build logs to see the result summary. Caution Issues requiring attention before PR completion 🔴 Manual Verification Required: New tests were added that are skipped in presubmit tests. See the "Manual Verification Required" section at the top for details. 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the recording VCR build log or the debug logs folder for detailed results. |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 9f0564d: Diff reportYour PR generated the following diffs in downstream repositories:
Missing test reportYour PR includes resource fields which are not covered by any test. Resource: resource "google_compute_bulk_per_instance_config" "primary" {
zone = # value needed
}
Missing service labelsThe following new resources do not have corresponding service labels:
If you believe this detection to be incorrect please raise the concern with your reviewer. Googlers: This error is safe to ignore once you've completed go/fix-missing-service-labels. Test reportImportant Manual Verification Required VCR cannot automatically execute the following tests added in this PR. Please verify them manually: 🔴 TestAccComputeBulkPerInstanceConfig_allInstancesChanged Analytics
Affected Service Packages
Step 1: Replaying Mode 🟢 All tests passed in Replaying mode! No Recording was needed. Caution Issues requiring attention before PR completion 🔴 Manual Verification Required: New tests were added that are skipped in presubmit tests. See the "Manual Verification Required" section at the top for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the replaying VCR build log |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 079e842: Diff reportYour PR generated the following diffs in downstream repositories:
Missing test reportYour PR includes resource fields which are not covered by any test. Resource: resource "google_compute_bulk_per_instance_config" "primary" {
zone = # value needed
}
Missing service labelsThe following new resources do not have corresponding service labels:
If you believe this detection to be incorrect please raise the concern with your reviewer. Googlers: This error is safe to ignore once you've completed go/fix-missing-service-labels. Test reportImportant Manual Verification Required VCR cannot automatically execute the following tests added in this PR. Please verify them manually: 🔴 TestAccComputeBulkPerInstanceConfig_allInstancesChanged Analytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the replaying VCR build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Manual Verification Required: New tests were added that are skipped in presubmit tests. See the "Manual Verification Required" section at the top for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the recording VCR build log or the debug logs folder for detailed results. |
|
There's a pending code change to address the missing service label. |
| }.Register() | ||
| } | ||
|
|
||
| func ResourceComputeBulkPerInstanceConfig() *schema.Resource { |
There was a problem hiding this comment.
The new resource should be the generated resource, which means that a yaml file should be added into https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products/compute.
There was a problem hiding this comment.
Is it mandatory that new resources should be always the auto-generated (MMV1) resource? IIUC, this change was proposed as a handwritten resource (I don´t have context though why). Maybe @askubis can provide more context here.
Btw following the other handwritten resource, this should be in .go.tmpl directory, not in the .go directory. In that case, I can move it to proper directory.
There was a problem hiding this comment.
I think, most of the other comments are related to this. If we can clarify what kind of resource it would be, it will be easier to make those change accordingly.
There was a problem hiding this comment.
Is it mandatory that new resources should be always the auto-generated (MMV1) resource? IIUC, this change was proposed as a handwritten resource (I don´t have context though why). Maybe @askubis can provide more context here. Btw following the other handwritten resource, this should be in .go.tmpl directory, not in the .go directory. In that case, I can move it to proper directory.
More context is needed why this resource is implemented as the handwritten resource. If no special reason, the new resource should be the MMv1 generated resource.
There was a problem hiding this comment.
There was no reason that holds, there were some problems initially, but then we resigned from some of the functionalities and handwritten resource is no longer necessary.
We can move to auto-generated.
There was a problem hiding this comment.
No, I think the handwriten resource is necessary. The reason is that for READ we use listManagedInstances, which returns a response as "managedInstances" while the generated READ method requires it to be "items".
If there was some custom_read or custom_flatten on the whole read API response then this resource could be a generated resource. Please correct me if I'm wrong. This was the only reason that I gave up doing it as yaml.
To have READ correctness we also need to filter out some of listManagedInstance responses but this would be doable I guess if we could modify flatten (decoder doesn't work in this case) or custom_read
There was a problem hiding this comment.
No, I think the handwriten resource is necessary. The reason is that for READ we use listManagedInstances, which returns a response as "managedInstances" while the generated READ method requires it to be "items".
If there was some custom_read or custom_flatten on the whole read API response then this resource could be a generated resource. Please correct me if I'm wrong. This was the only reason that I gave up doing it as yaml.
To have READ correctness we also need to filter out some of listManagedInstance responses but this would be doable I guess if we could modify flatten (decoder doesn't work in this case) or custom_read
Can you explain more that the generated READ method requires it to be "items"?
There was a problem hiding this comment.
On the top of that, we need to poll managed instances via list API until all the managed instances are deleted. It's required to ensure all the instances are deleted before creating them again with the same name. And in generated resource, it's not supported. I can see this was handled in mmv1/third_party/terraform/services/compute/stateful_mig_polling.go which provides such facilities which is handwritten.
| "github.com/hashicorp/terraform-plugin-testing/terraform" | ||
| transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" | ||
| ) | ||
|
|
There was a problem hiding this comment.
All the tests should also be moved to the yaml file with samples.
Docs: https://googlecloudplatform.github.io/magic-modules/test/test/#steps
| @@ -0,0 +1,20 @@ | |||
| resource: google_compute_bulk_per_instance_config | |||
There was a problem hiding this comment.
This file is not needed with the yaml file.
| @@ -0,0 +1,77 @@ | |||
| --- | |||
| subcategory: "Compute Engine" | |||
There was a problem hiding this comment.
This file is not needed with the yaml file.
|
|
||
| func TestAccComputeBulkPerInstanceConfig_oneInstanceChanged(t *testing.T) { | ||
| // Multiple fine-grained resources | ||
| acctest.SkipIfVcr(t) |
There was a problem hiding this comment.
what is the reason to skip the vcr test? Will the VCR test fail if not skipped?
|
Hi @zli82016, I will takeover the PR as the original author of the PR is OOO till next week and the PR need to be submitted by this week to meet the customer deadline. |
|
@zli82016 This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
This PR introduces a new virtual resource for instance group managers: BulkPerInstanceConfig.
In this version it accepts only instance names which makes it possible to call instanceGroupManagers.CreateInstances with more than 1 instance in a single call. So far it was limited to a single PerInstanceConfig.
BulkPerInstanceConfig is immutable and on each modification it will call instanceGroupManagers.DeleteInstances on Destroy and instanceGroupManagers.CreateInstances on Create. Thanks to that Update is not implemented.
instance group manager should be configured to ignore target_size changes, as BulkPerInstanceConfig modifies this value.
Release Note Template for Downstream PRs (will be copied)
See Write release notes for guidance.