{"record":{"id":"94aca8eefaf90a15","repo":"kubernetes/kops","slug":"error-rendering-publickey-v","errorCode":null,"errorMessage":"error rendering PublicKey: %v","messagePattern":"error rendering PublicKey: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/sshkey.go","lineNumber":203,"sourceCode":"\t}\n\treturn nil\n}\n\ntype terraformSSHKey struct {\n\tName      *string                  `cty:\"key_name\"`\n\tPublicKey *terraformWriter.Literal `cty:\"public_key\"`\n\tTags      map[string]string        `cty:\"tags\"`\n}\n\nfunc (_ *SSHKey) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *SSHKey) error {\n\t// We don't want to render a key definition when we're using one that already exists\n\tif e.IsExistingKey() {\n\t\treturn nil\n\t}\n\ttfName := strings.ReplaceAll(*e.Name, \":\", \"\")\n\tpublicKey, err := t.AddFileResource(\"aws_key_pair\", tfName, \"public_key\", e.PublicKey, false)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error rendering PublicKey: %v\", err)\n\t}\n\n\ttf := &terraformSSHKey{\n\t\tName:      e.Name,\n\t\tPublicKey: publicKey,\n\t\tTags:      e.Tags,\n\t}\n\n\treturn t.RenderResource(\"aws_key_pair\", tfName, tf)\n}\n\n// IsExistingKey will be true if the task has been initialized without using a public key\n// this is when we want to use a key that is already present in AWS.\nfunc (e *SSHKey) IsExistingKey() bool {\n\treturn e.PublicKey == nil\n}\n\nfunc (e *SSHKey) TerraformLink() *terraformWriter.Literal {","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/sshkey.go#L185-L221","documentation":"RenderTerraform failed to write the admin SSH public key as the aws_key_pair public_key file in the Terraform output — a Terraform-writer/VFS write error, not an SSH key parsing problem.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/awstasks/sshkey.go:203 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the Terraform output directory is writable and not corrupted","Re-run `kops update cluster --target=terraform` to regenerate the output"],"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"}