{"record":{"id":"0eae37629f52a1c7","repo":"kubernetes/kops","slug":"cannot-apply-changes-to-targetpool-v","errorCode":null,"errorMessage":"cannot apply changes to TargetPool: %v","messagePattern":"cannot apply changes to TargetPool: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/targetpool.go","lineNumber":103,"sourceCode":"\tname := fi.ValueOf(e.Name)\n\n\to := &compute.TargetPool{\n\t\tName: name,\n\t}\n\n\tif a == nil {\n\t\tklog.V(4).Infof(\"Creating TargetPool %q\", o.Name)\n\n\t\top, err := t.Cloud.Compute().TargetPools().Insert(t.Cloud.Project(), t.Cloud.Region(), o)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error creating TargetPool %q: %v\", name, err)\n\t\t}\n\n\t\tif err := t.Cloud.WaitForOp(op); err != nil {\n\t\t\treturn fmt.Errorf(\"error creating TargetPool: %v\", err)\n\t\t}\n\t} else {\n\t\treturn fmt.Errorf(\"cannot apply changes to TargetPool: %v\", changes)\n\t}\n\n\treturn nil\n}\n\ntype terraformTargetPool struct {\n\tName         string                     `cty:\"name\"`\n\tHealthChecks []*terraformWriter.Literal `cty:\"health_checks\"`\n}\n\nfunc (_ *TargetPool) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *TargetPool) error {\n\tname := fi.ValueOf(e.Name)\n\n\ttf := &terraformTargetPool{\n\t\tName: name,\n\t\tHealthChecks: []*terraformWriter.Literal{\n\t\t\te.HealthCheck.TerraformLink(),\n\t\t},","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/targetpool.go#L85-L121","documentation":"RenderGCE only supports creating a TargetPool or leaving it unchanged; if the computed diff shows any changes to an existing TargetPool, it refuses with this error. GCE target pools are largely immutable in kOps' model, so in-place updates are not attempted.","triggerScenarios":"Find() returns an existing TargetPool whose fields differ from the spec (changes != empty), so RenderGCE hits the else branch and returns 'cannot apply changes to TargetPool: %v' with the diff in %v.","commonSituations":"Manually editing the target pool in GCP console so it drifts from the cluster spec; upgrading the cluster spec in ways that alter target pool properties; health-check or instance-group changes that surface as target pool diffs.","solutions":["Read the %v diff in the message to see which fields changed","Revert out-of-band GCP console changes so the target pool matches the spec","Delete the target pool (via kops/`gcloud`) and re-run `kops update cluster` to recreate it with the desired config","If the diff is caused by a spec change, plan for LB recreation (note downtime implications)"],"exampleFix":"// kops-side behavior\n} else {\n\treturn fmt.Errorf(\"cannot apply changes to TargetPool: %v\", changes)\n}\n// user-side fix: delete and recreate\n// gcloud compute target-pools delete <name> --region <region> && kops update cluster --yes","handlingStrategy":"fallback","validationCode":"diff <(gcloud compute target-pools describe <name> --region <region> --format=yaml) <(kops toolbox dump / expected config)  # detect drift before applying","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never edit kOps-managed target pools in the GCP console","Expect recreation (not in-place edit) when LB properties change in the spec","Review `kops update cluster` diff output for target pool changes before --yes"],"tags":["gcp","gce","targetpool","drift"],"backgroundTag":"immutable-resource-drift","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"}