kubernetes/kops · error

expected at most one zone for disk %q, got %d

Error message

expected at most one zone for disk %q, got %d

What it means

Validation guard in the Azure managed-disk Terraform renderer: an Azure managed disk can be zoned or non-zoned, but its zones list must contain at most one entry. Fires when the source model supplies multiple availability zones for a single disk, which the cty schema cannot represent.

Source

Thrown at upup/pkg/fi/cloudup/azuretasks/disk_terraform.go:41

	"k8s.io/kops/upup/pkg/fi"
	"k8s.io/kops/upup/pkg/fi/cloudup/terraform"
	"k8s.io/kops/upup/pkg/fi/cloudup/terraformWriter"
)

type terraformAzureManagedDisk struct {
	Name               *string                  `cty:"name"`
	Location           *string                  `cty:"location"`
	ResourceGroupName  *terraformWriter.Literal `cty:"resource_group_name"`
	StorageAccountType *string                  `cty:"storage_account_type"`
	CreateOption       *string                  `cty:"create_option"`
	DiskSizeGB         *int32                   `cty:"disk_size_gb"`
	Zone               *string                  `cty:"zone"`
	Tags               map[string]string        `cty:"tags"`
}

func (*Disk) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Disk) error {
	if len(e.Zones) > 1 {
		return fmt.Errorf("expected at most one zone for disk %q, got %d", fi.ValueOf(e.Name), len(e.Zones))
	}

	createOption := string(compute.DiskCreateOptionEmpty)
	tf := &terraformAzureManagedDisk{
		Name:               e.Name,
		Location:           new(t.Cloud.Region()),
		ResourceGroupName:  e.ResourceGroup.terraformName(),
		StorageAccountType: stringPtr(e.VolumeType),
		CreateOption:       &createOption,
		DiskSizeGB:         e.SizeGB,
		Tags:               stringMap(e.Tags),
	}
	if len(e.Zones) == 1 {
		tf.Zone = e.Zones[0]
	}

	return t.RenderResource("azurerm_managed_disk", fi.ValueOf(e.Name), tf)
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set a single availability zone on the disk in the cluster spec
  2. Remove conflicting zone configuration from the etcd/main volume definitions
  3. Re-run kops create -f / terraform generation
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/azuretasks/disk_terraform.go:41 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/ecf75dfaaa643b13. Report an issue: GitHub.