{"record":{"id":"6d856836e4d47f81","repo":"kubernetes/kops","slug":"cannot-apply-changes-to-instancegroupmanager-v","errorCode":null,"errorMessage":"cannot apply changes to InstanceGroupManager: %v","messagePattern":"cannot apply changes to InstanceGroupManager: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/instancegroupmanager.go","lineNumber":182,"sourceCode":"\t\t\tnewSize := int64(0)\n\t\t\tif i.TargetSize != 0 {\n\t\t\t\tnewSize = int64(i.TargetSize)\n\t\t\t}\n\t\t\top, err := t.Cloud.Compute().InstanceGroupManagers().Resize(t.Cloud.Project(), *e.Zone, i.Name, newSize)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error resizing InstanceGroupManager: %v\", err)\n\t\t\t}\n\n\t\t\tif err := t.Cloud.WaitForOp(op); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error resizing InstanceGroupManager: %v\", err)\n\t\t\t}\n\n\t\t\tchanges.TargetSize = nil\n\t\t}\n\n\t\tempty := &InstanceGroupManager{}\n\t\tif !reflect.DeepEqual(empty, changes) {\n\t\t\treturn fmt.Errorf(\"cannot apply changes to InstanceGroupManager: %v\", changes)\n\t\t}\n\t}\n\n\treturn nil\n}\n\ntype terraformInstanceGroupManager struct {\n\tLifecycle                   *terraform.Lifecycle       `cty:\"lifecycle\"`\n\tName                        *string                    `cty:\"name\"`\n\tZone                        *string                    `cty:\"zone\"`\n\tBaseInstanceName            *string                    `cty:\"base_instance_name\"`\n\tListManagedInstancesResults string                     `cty:\"list_managed_instances_results\"`\n\tVersion                     *terraformVersion          `cty:\"version\"`\n\tTargetSize                  *int64                     `cty:\"target_size\"`\n\tUpdatePolicy                *terraformUpdatePolicy     `cty:\"update_policy\"`\n\tTargetPools                 []*terraformWriter.Literal `cty:\"target_pools\"`\n}\n","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/instancegroupmanager.go#L164-L200","documentation":"During RenderGCE for an existing GCE InstanceGroupManager (managed instance group), kOps only knows how to update three mutable fields in place: TargetPools, InstanceTemplate, and TargetSize. After applying those updates it checks whether any other changed fields remain in the `changes` struct; if so, it refuses with this error because applying them would require recreating the group, which the task does not support.","triggerScenarios":"Running `kops update cluster --target direct` against GCE when an existing managed instance group has drifted in any field other than TargetPools/InstanceTemplate/TargetSize — e.g. someone manually edited the MIG's name, zone, base instance name, or auto-healing/health-check settings in the GCP console, or a kOps version change altered how a field is modeled.","commonSituations":"Out-of-band edits to the MIG via gcloud/console; upgrading kOps to a version that represents a new InstanceGroupManager field (so it appears as a change on first run); attempting to change immutable properties like the group's base instance name or network through the cluster spec.","solutions":["Inspect the printed `changes` struct to identify which field(s) kOps wants to change","Revert the out-of-band change in GCP (or update the kOps cluster spec so the field matches what's in GCP) so no unexpected diff remains","If the change is intentional and unsupported in-place, delete and recreate the instance group (or the whole cluster with `kops delete cluster` / replace the MIG)","Check kOps release notes / issues for the field; a newer kOps may support updating it — upgrade kOps","Run with `--v=10` and use `kops update cluster --dry-run` to preview the diff before applying"],"exampleFix":"// changes printed: {BaseInstanceName:&\"ig--nodes-1x\" ...}\n// before: MIG base instance name edited manually in GCP console\n// after: revert in GCP so it matches kOps spec, or change spec to match:\n//   kops edit instancegroup nodes  # align fields; then kops update cluster","handlingStrategy":"validation","validationCode":"// Preview drift before applying:\n//   kops update cluster <cluster> --target dryrun --v=10\n// In CI, guard against out-of-band edits:\n//   kops get instancegroups <cluster> -o yaml > spec.yaml\n//   kops update cluster <cluster> --target terraform -o out/ && git diff --exit-code out/","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never edit managed instance groups directly in the GCP console/gcloud; change the kOps spec instead","Run `kops update cluster --dry-run` in CI to catch drift early","After kOps upgrades, review release notes for newly modeled InstanceGroupManager fields","Scale MIGs via kOps (cluster spec) rather than `gcloud compute instance-groups managed resize`"],"tags":["gce","instance-group-manager","unsupported-change","drift"],"backgroundTag":"unsupported-in-place-update","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}