kubernetes/kops · error

error rendering Scaleway file: %w

Error message

error rendering Scaleway file: %w

What it means

This error is returned by S3Path.RenderTerraform in util/pkg/vfs/s3fs.go when the TerraformWriter fails while registering a Scaleway object-storage file resource (scaleway_object) during kops' terraform rendering. AddFileBytes hashes/records the file bytes for the terraform output; any failure there (typically I/O or writer-state problems) is wrapped with this message. It only fires for vfs paths whose scheme is 'scw'.

Source

Thrown at util/pkg/vfs/s3fs.go:737

		if endpoint == "" {
			return errors.New("S3 Endpoint is empty")
		}
		region := strings.Split(endpoint, ".")[0]

		tf := &terraformDOFile{
			Bucket:  p.Bucket(),
			Region:  region,
			Key:     p.Key(),
			Content: content,
		}
		return w.RenderResource("digitalocean_spaces_bucket_object", name, tf)

		// render Scaleway's Terraform objects
	case "scw":

		content, err := w.AddFileBytes("scaleway_object", name, "content", bytes, false)
		if err != nil {
			return fmt.Errorf("error rendering Scaleway file: %w", err)
		}

		tf := terraformScwFile{
			Bucket:  p.Bucket(),
			Key:     p.Key(),
			Content: content,
		}
		return w.RenderResource("scaleway_object", name, tf)

	default:
		bucketDetails, err := p.getBucketDetails(ctx)
		if err != nil {
			return err
		}

		tfProviderArguments := map[string]string{
			"region": bucketDetails.region,
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the wrapped cause (%w) for the real failure — usually a filesystem or terraform-writer error, not a Scaleway API error
  2. Ensure the --out terraform directory exists and is writable
  3. Verify the state store path really uses the scw scheme intentionally; if you meant AWS S3, fix the cluster config so the default (aws) branch is used
  4. Re-run with --v=2 or higher logging to see the underlying AddFileBytes failure

Example fix

// before
content, err := w.AddFileBytes("scaleway_object", name, "content", bytes, false)
if err != nil {
	return fmt.Errorf("error rendering Scaleway file: %w", err)
}
// after
// inspect the wrapped error to find the real cause:
content, err := w.AddFileBytes("scaleway_object", name, "content", bytes, false)
if err != nil {
	return fmt.Errorf("error rendering Scaleway file: %w", err) // log err with %+v to see the root cause
}
Defensive patterns

Strategy: validation

Validate before calling

// before rendering, ensure the terraform output dir is writable
if info, err := os.Stat(outDir); err != nil || !info.IsDir() {
	os.MkdirAll(outDir, 0o755)
}

Try / catch

if err := p.RenderTerraform(w, name, data, acl); err != nil {
	var wrapped error
	if errors.Unwrap(err) != nil { wrapped = errors.Unwrap(err) }
	return fmt.Errorf("scaleway terraform render failed (cause: %v): %w", wrapped, err)
}

Prevention

When it happens

Trigger: Calling RenderTerraform on an S3Path created with scheme 'scw' (e.g. a state store or cluster manifest location using scw://) where w.AddFileBytes("scaleway_object", name, "content", bytes, false) returns an error — e.g. the underlying terraform writer fails to buffer/hash the file content.

Common situations: Running `kops update cluster --target=terraform` with a Scaleway-compatible S3 endpoint; misconfigured VFS state store; terraform output directory not writable causing the writer to fail while adding the file bytes.

Related errors


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