kubernetes/kops · error

unexpected target type for deletion: %T

Error message

unexpected target type for deletion: %T

What it means

The deferred deletion of a subnet IPv6 CIDR block only works against the AWS API target; the Delete method was handed a different CloudupTarget implementation (e.g. Terraform or a dry-run target), which cannot perform the EC2 disassociation.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/subnet.go:530

		})
	}

	return removals, nil
}

type deleteSubnetIPv6CIDRBlock struct {
	vpcID         *string
	ipv6CidrBlock *string
	associationID *string
}

var _ fi.CloudupDeletion = (*deleteSubnetIPv6CIDRBlock)(nil)

func (d *deleteSubnetIPv6CIDRBlock) Delete(t fi.CloudupTarget) error {
	ctx := context.TODO()
	awsTarget, ok := t.(*awsup.AWSAPITarget)
	if !ok {
		return fmt.Errorf("unexpected target type for deletion: %T", t)
	}

	request := &ec2.DisassociateSubnetCidrBlockInput{
		AssociationId: d.associationID,
	}
	_, err := awsTarget.Cloud.EC2().DisassociateSubnetCidrBlock(ctx, request)
	return err
}

func (d *deleteSubnetIPv6CIDRBlock) TaskName() string {
	return "SubnetIPv6CIDRBlock"
}

func (d *deleteSubnetIPv6CIDRBlock) Item() string {
	return fmt.Sprintf("%v: ipv6cidr=%v", *d.vpcID, *d.ipv6CidrBlock)
}

func (d *deleteSubnetIPv6CIDRBlock) DeferDeletion() bool {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Run the deletion against the AWS target (plain `kops delete cluster`)
  2. Apply the Terraform output so the AWS API target is used for cleanup
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/awstasks/subnet.go:530 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/55410d4d6b578a94. Report an issue: GitHub.