{"record":{"id":"680a232eb7100ff6","repo":"kubernetes/kops","slug":"error-rendering-publickey-v-680a23","errorCode":null,"errorMessage":"error rendering PublicKey: %v","messagePattern":"error rendering PublicKey: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/dotasks/sshkey.go","lineNumber":177,"sourceCode":"\t}\n\n\treturn nil\n}\n\ntype terraformSSHKey struct {\n\tName      *string                  `cty:\"name\"`\n\tPublicKey *terraformWriter.Literal `cty:\"public_key\"`\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(\"digitalocean_ssh_key\", 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}\n\n\treturn t.RenderResource(\"digitalocean_ssh_key\", 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 the cloud.\nfunc (e *SSHKey) IsExistingKey() bool {\n\treturn e.PublicKey == nil\n}\n\nfunc (e *SSHKey) TerraformLink() *terraformWriter.Literal {\n\tif e.NoSSHKey() {","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/dotasks/sshkey.go#L159-L195","documentation":"Wraps TerraformTarget.AddFileResource failure while writing the SSH public key as a Terraform file asset for the digitalocean_ssh_key resource. Fires on I/O/path failures writing to the Terraform output, not on key content problems.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/dotasks/sshkey.go:177 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check write permissions and disk space in the output directory","Inspect the wrapped error","Re-run Terraform generation"],"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"}