kubernetes/kops · error

error creating SSH keypair: %w

Error message

error creating SSH keypair: %w

What it means

Thrown in RenderScw after building the CreateSSHKeyRequest when the Scaleway IAM API call CreateSSHKey fails. This is a cloud-side failure: invalid credentials, expired token, quota limits, a duplicate key name already registered in the Scaleway project, or a network/API outage.

Source

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

	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"`
}

func (_ *SSHKey) RenderTerraform(t *terraform.TerraformTarget, actual, expected, changes *SSHKey) error {
	tfName := strings.ReplaceAll(fi.ValueOf(expected.Name), ".", "-")
	publicKeyStr, err := fi.ResourceAsString(fi.ValueOf(expected.PublicKey))
	if err != nil {
		return err
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the wrapped error for the Scaleway API status (409 duplicate name, 401 auth, 429 quota/rate limit)
  2. Delete a pre-existing SSH key with the same name in the Scaleway console, or rename the key in the spec
  3. Verify Scaleway API credentials and that the organization/project has SSH key quota available
  4. Retry after transient API errors; the apply is idempotent and will re-render
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/scalewaytasks/sshkey.go:136 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/496ed8a7ec400cdd. Report an issue: GitHub.