{"record":{"id":"85d9551316ae459d","repo":"kubernetes/kops","slug":"error-creating-instancetemplate-v","errorCode":null,"errorMessage":"error creating InstanceTemplate: %v","messagePattern":"error creating InstanceTemplate: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/instancetemplate.go","lineNumber":537,"sourceCode":"func (_ *InstanceTemplate) RenderGCE(t *gce.GCEAPITarget, a, e, changes *InstanceTemplate) error {\n\tproject := t.Cloud.Project()\n\tregion := t.Cloud.Region()\n\n\ti, err := e.mapToGCE(project, region)\n\tif err != nil {\n\t\treturn err\n\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\"`","sourceCodeStart":519,"sourceCodeEnd":555,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/instancetemplate.go#L519-L555","documentation":"Wrapped error from InstanceTemplate.RenderGCE when the synchronous InstanceTemplates.Insert call fails while creating a new template (a == nil). GCE rejected the create — typical causes are invalid machine type, bad metadata/service-account fields, or permissions/quota.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/gcetasks/instancetemplate.go:537 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the wrapped API error to find the rejected field","Verify machine type, service account, and image reference in the template spec","Fix permissions/quota and re-run the apply"],"exampleFix":null,"handlingStrategy":"try-catch","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"}