kubernetes/kops · error

error rendering SSH public key

Error message

error rendering SSH public key: %w

What it means

Thrown in RenderScw while materializing the expected PublicKey resource into a string before creating the Scaleway SSH key. fi.ResourceAsString failed, meaning the resource backing the PublicKey field could not be loaded (missing secret, unreadable file, or failed fetch) — the failure is in reading the resource, not in talking to Scaleway.

Solutions

  1. Check that the resource referenced by expected.PublicKey (file, secret, or generated keypair) exists and is readable
  2. If the key comes from a secret, verify the secret was created in an earlier task and its dependency is declared
  3. Inspect the underlying error to see whether it is an auth/path problem on the resource source
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/scalewaytasks/sshkey.go:129 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/28161c1097d1547d. Report an issue: GitHub.

Appendix: source

Thrown at upup/pkg/fi/cloudup/scalewaytasks/sshkey.go:129

func (*SSHKey) RenderScw(t *scaleway.ScwAPITarget, actual, expected, changes *SSHKey) error {
	if actual != nil {
		klog.Infof("Scaleway does not support changes to ssh keys for the moment")
		return nil
	}

	name := fi.ValueOf(expected.Name)
	if name == "" {
		return fi.RequiredField("Name")
	}
	klog.V(2).Infof("Creating keypair with name: %q", name)

	keyArgs := &iam.CreateSSHKeyRequest{
		Name: name,
	}
	if expected.PublicKey != nil {
		d, err := fi.ResourceAsString(*expected.PublicKey)
		if err != nil {
			return fmt.Errorf("error rendering SSH public key: %w", err)
		}
		keyArgs.PublicKey = d
	}

	key, err := t.Cloud.IamService().CreateSSHKey(keyArgs)
	if err != nil {
		return fmt.Errorf("error creating SSH keypair: %w", err)
	}
	expected.KeyPairFingerPrint = new(key.Fingerprint)
	klog.V(2).Infof("Created a new SSH keypair, id=%q fingerprint=%q", key.ID, key.Fingerprint)

	return nil
}

type terraformSSHKey struct {
	Name      *string `cty:"name"`
	PublicKey *string `cty:"public_key"`
}

View on GitHub (pinned to 4c8573c808)