{"record":{"id":"0dcafabdc1230cf9","repo":"kubernetes/kops","slug":"cannot-apply-changes-to-instancetemplate-v","errorCode":null,"errorMessage":"Cannot apply changes to InstanceTemplate: %v","messagePattern":"Cannot apply changes to InstanceTemplate: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/instancetemplate.go","lineNumber":544,"sourceCode":"\t}\n\n\tif a == nil {\n\t\tklog.V(4).Infof(\"Creating InstanceTemplate %v\", i)\n\n\t\tname := fi.ValueOf(e.NamePrefix) + \"-\" + strconv.FormatInt(time.Now().Unix(), 10)\n\t\te.ID = &name\n\t\ti.Name = name\n\n\t\top, err := t.Cloud.Compute().InstanceTemplates().Insert(t.Cloud.Project(), i)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error creating InstanceTemplate: %v\", err)\n\t\t}\n\n\t\tif err := t.Cloud.WaitForOp(op); err != nil {\n\t\t\treturn fmt.Errorf(\"error creating InstanceTemplate: %v\", err)\n\t\t}\n\t} else {\n\t\treturn fmt.Errorf(\"Cannot apply changes to InstanceTemplate: %v\", changes)\n\t}\n\n\treturn nil\n}\n\ntype terraformInstanceTemplate struct {\n\tLifecycle             *terraform.Lifecycle                     `cty:\"lifecycle\"`\n\tNamePrefix            string                                   `cty:\"name_prefix\"`\n\tCanIPForward          bool                                     `cty:\"can_ip_forward\"`\n\tMachineType           string                                   `cty:\"machine_type\"`\n\tServiceAccounts       []*terraformTemplateServiceAccount       `cty:\"service_account\"`\n\tScheduling            *terraformScheduling                     `cty:\"scheduling\"`\n\tDisks                 []*terraformInstanceTemplateAttachedDisk `cty:\"disk\"`\n\tLabels                map[string]string                        `cty:\"labels\"`\n\tNetworkInterfaces     []*terraformNetworkInterface             `cty:\"network_interface\"`\n\tMetadata              map[string]*terraformWriter.Literal      `cty:\"metadata\"`\n\tMetadataStartupScript *terraformWriter.Literal                 `cty:\"metadata_startup_script\"`\n\tTags                  []string                                 `cty:\"tags\"`","sourceCodeStart":526,"sourceCodeEnd":562,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/instancetemplate.go#L526-L562","documentation":"Returned from InstanceTemplate.RenderGCE when the template already exists (a != nil). Instance templates are immutable in this task — no update path exists, so any non-empty diff is rejected. (Normally instance-template drift is handled by generating a new template name and rolling the IG.)","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/gcetasks/instancetemplate.go:544 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the printed diff to see what drifted from the managed template","Trigger a rolling update so a new template is created and instances are replaced","Remove manual changes to the instance template or align the spec with reality"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}