Skip to content

Add instance group manager bulk per instance config resource.#18017

Closed
pjotrekk wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
pjotrekk:bulk_pic
Closed

Add instance group manager bulk per instance config resource.#18017
pjotrekk wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
pjotrekk:bulk_pic

Conversation

@pjotrekk

@pjotrekk pjotrekk commented Jun 19, 2026

Copy link
Copy Markdown
Member

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.

`google_compute_bulk_per_instance_config`

@github-actions github-actions Bot requested a review from zli82016 June 19, 2026 12:23
@github-actions

Copy link
Copy Markdown

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,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should disable importing

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removed OptionalForImport

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

@modular-magician

modular-magician commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit aca9f7f:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 4 files changed, 1098 insertions(+)
google-beta provider View Diff 4 files changed, 1098 insertions(+)

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_bulk_per_instance_config (5 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_bulk_per_instance_config" "primary" {
  zone = # value needed
}

Missing service labels

The following new resources do not have corresponding service labels:

  • google_compute_bulk_per_instance_config

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.
An override-missing-service-label label can be added to allow merging.

Test report

Important

Manual Verification Required

VCR cannot automatically execute the following tests added in this PR. Please verify them manually:

🔴 TestAccComputeBulkPerInstanceConfig_allInstancesChanged
🔴 TestAccComputeBulkPerInstanceConfig_basic
🔴 TestAccComputeBulkPerInstanceConfig_oneInstanceChanged

Analytics

Total Tests Passed Skipped Affected
1486 1 96 1389
Affected Service Packages
  • compute

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

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

@pjotrekk, @zli82016 VCR tests complete for aca9f7f!

@modular-magician

modular-magician commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 9f0564d:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 4 files changed, 1103 insertions(+)
google-beta provider View Diff 4 files changed, 1103 insertions(+)

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_bulk_per_instance_config (5 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_bulk_per_instance_config" "primary" {
  zone = # value needed
}

Missing service labels

The following new resources do not have corresponding service labels:

  • google_compute_bulk_per_instance_config

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.
An override-missing-service-label label can be added to allow merging.

Test report

Important

Manual Verification Required

VCR cannot automatically execute the following tests added in this PR. Please verify them manually:

🔴 TestAccComputeBulkPerInstanceConfig_allInstancesChanged
🔴 TestAccComputeBulkPerInstanceConfig_basic
🔴 TestAccComputeBulkPerInstanceConfig_oneInstanceChanged

Analytics

Total Tests Passed Skipped Affected
1486 1390 96 0
Affected Service Packages
  • compute

Learn how VCR tests work


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

@pjotrekk, @zli82016 VCR tests complete for 9f0564d!

@modular-magician

modular-magician commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 079e842:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 4 files changed, 1103 insertions(+)
google-beta provider View Diff 4 files changed, 1103 insertions(+)

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_bulk_per_instance_config (5 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_bulk_per_instance_config" "primary" {
  zone = # value needed
}

Missing service labels

The following new resources do not have corresponding service labels:

  • google_compute_bulk_per_instance_config

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.
An override-missing-service-label label can be added to allow merging.

Test report

Important

Manual Verification Required

VCR cannot automatically execute the following tests added in this PR. Please verify them manually:

🔴 TestAccComputeBulkPerInstanceConfig_allInstancesChanged
🔴 TestAccComputeBulkPerInstanceConfig_basic
🔴 TestAccComputeBulkPerInstanceConfig_oneInstanceChanged

Analytics

Total Tests Passed Skipped Affected
1486 1389 96 1
Affected Service Packages
  • compute

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccComputeRouterPeer_UpdateMd5AuthenticationKey

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
✅ Log TestAccComputeRouterPeer_UpdateMd5AuthenticationKey

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.

@pjotrekk, @zli82016 VCR tests complete for 079e842!

@askubis

askubis commented Jun 22, 2026

Copy link
Copy Markdown
Member

There's a pending code change to address the missing service label.

}.Register()
}

func ResourceComputeBulkPerInstanceConfig() *schema.Resource {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@chayankumar999 chayankumar999 Jun 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@pjotrekk pjotrekk Jun 23, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

will the custom decoder not work? @zli82016

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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"?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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"
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This file is not needed with the yaml file.

@@ -0,0 +1,77 @@
---
subcategory: "Compute Engine"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This file is not needed with the yaml file.


func TestAccComputeBulkPerInstanceConfig_oneInstanceChanged(t *testing.T) {
// Multiple fine-grained resources
acctest.SkipIfVcr(t)

@zli82016 zli82016 Jun 22, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what is the reason to skip the vcr test? Will the VCR test fail if not skipped?

@chayankumar999

chayankumar999 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

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 zli82016 requested a review from slevenick June 23, 2026 20:03
@github-actions

Copy link
Copy Markdown

@zli82016 This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@askubis

askubis commented Jun 26, 2026

Copy link
Copy Markdown
Member

@zli82016 This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@zli82016, please ignore this (or close this PR) - the #18070 was merged as a better version of this functionality.

@slevenick slevenick closed this Jun 26, 2026
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.

6 participants