kubernetes/kops · error

rendering GCS file: %v

Error message

rendering GCS file: %v

What it means

Returned by GSPath.RenderTerraform when the TerraformWriter fails while emitting the google_storage_object resource for this path — e.g. a file name conflict in the writer, an invalid resource name, or an I/O error writing the .tf output. It is a guard on the writer step after the data has been successfully read.

Source

Thrown at util/pkg/vfs/gsfs.go:496

type terraformGSObjectAccessControl struct {
	Bucket     string                   `json:"bucket" cty:"bucket"`
	Object     *terraformWriter.Literal `json:"object" cty:"object"`
	RoleEntity []string                 `json:"role_entity" cty:"role_entity"`
	Provider   *terraformWriter.Literal `json:"provider,omitempty" cty:"provider"`
}

func (p *GSPath) RenderTerraform(w *terraformWriter.TerraformWriter, name string, data io.Reader, acl ACL) error {
	bytes, err := io.ReadAll(data)
	if err != nil {
		return fmt.Errorf("reading data: %v", err)
	}

	tfProviderArguments := map[string]string{} // GCS doesn't need the project and region specified
	w.EnsureTerraformProvider("google", tfProviderArguments)

	content, err := w.AddFilePath("google_storage_bucket_object", name, "content", bytes, false)
	if err != nil {
		return fmt.Errorf("rendering GCS file: %v", err)
	}

	tf := &terraformGSObject{
		Bucket:   p.Bucket(),
		Name:     p.Object(),
		Source:   content,
		Provider: terraformWriter.LiteralTokens("google", "files"),
	}
	err = w.RenderResource("google_storage_bucket_object", name, tf)
	if err != nil {
		return err
	}

	// file ACLs can be empty on GCP, because of a bucket-only ACL.
	if acl != nil {
		tfACL := &terraformGSObjectAccessControl{
			Bucket:     p.Bucket(),
			Object:     p.TerraformLink(name),

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the underlying writer error: duplicate resource names usually mean the same path is rendered twice with one name
  2. Ensure the destination Terraform output is writable
  3. Fix or deduplicate the resource name passed to RenderTerraform
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at util/pkg/vfs/gsfs.go:496 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/fe4e344c45f44d29. Report an issue: GitHub.