kubernetes/kops · error

InstanceTemplate not yet built; ID is not yet known

Error message

InstanceTemplate not yet built; ID is not yet known

What it means

Sentinel-style validation error from InstanceTemplate.URL when the template's ID field is nil. URL is called to build a self-link before the template has been rendered/created — the ID (generated name) is only assigned inside RenderGCE, so this indicates a task ordering issue where a dependent task needs the URL first.

Source

Thrown at upup/pkg/fi/cloudup/gcetasks/instancetemplate.go:514

	normalizedL := normalize(l)
	normalizedR := normalize(r)

	if !reflect.DeepEqual(normalizedL, normalizedR) {
		if klog.V(10).Enabled() {
			ls := fi.DebugAsJsonStringIndent(normalizedL)
			rs := fi.DebugAsJsonStringIndent(normalizedR)
			klog.V(10).Info("Not equal")
			klog.V(10).Info(diff.FormatDiff(ls, rs))
		}
		return false
	}

	return true
}

func (e *InstanceTemplate) URL(project string) (string, error) {
	if e.ID == nil {
		return "", fmt.Errorf("InstanceTemplate not yet built; ID is not yet known")
	}
	return fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/global/instanceTemplates/%s", project, *e.ID), nil
}

func (_ *InstanceTemplate) RenderGCE(t *gce.GCEAPITarget, a, e, changes *InstanceTemplate) error {
	project := t.Cloud.Project()
	region := t.Cloud.Region()

	i, err := e.mapToGCE(project, region)
	if err != nil {
		return err
	}

	if a == nil {
		klog.V(4).Infof("Creating InstanceTemplate %v", i)

		name := fi.ValueOf(e.NamePrefix) + "-" + strconv.FormatInt(time.Now().Unix(), 10)
		e.ID = &name

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Ensure tasks that reference the instance template URL declare a dependency on the InstanceTemplate task so it is built first
  2. Re-run the apply — if creation succeeded previously, Find() will populate the ID
  3. Check for a deleted instance template that a dependent resource still references
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/gcetasks/instancetemplate.go:514 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/cde62325b5294dbb. Report an issue: GitHub.