kubernetes/kops · error
Missing VPC task from target group: %v %v
Error message
Missing VPC task from target group: %v %v
What it means
RenderTerraform for a TargetGroup requires the VPC task reference to emit the terraform resource, and returns this error when e.VPC is nil. (Note the message prints %v twice for e and e.VPC, so the second value is always <nil> — a known cosmetic wart.) For shared target groups it returns early, so only managed target groups hit this.
Source
Thrown at upup/pkg/fi/cloudup/awstasks/targetgroup.go:473
HealthCheck terraformTargetGroupHealthCheck `cty:"health_check"`
}
type terraformTargetGroupHealthCheck struct {
Interval int32 `cty:"interval"`
HealthyThreshold int32 `cty:"healthy_threshold"`
UnhealthyThreshold int32 `cty:"unhealthy_threshold"`
Protocol elbv2types.ProtocolEnum `cty:"protocol"`
Path *string `cty:"path"`
}
func (_ *TargetGroup) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *TargetGroup) error {
shared := fi.ValueOf(e.Shared)
if shared {
return nil
}
if e.VPC == nil {
return fmt.Errorf("Missing VPC task from target group:\n%v\n%v", e, e.VPC)
}
tf := &terraformTargetGroup{
Name: *e.Name,
Port: *e.Port,
Protocol: e.Protocol,
VPCID: e.VPC.TerraformLink(),
Tags: e.Tags,
HealthCheck: terraformTargetGroupHealthCheck{
Interval: *e.Interval,
HealthyThreshold: *e.HealthyThreshold,
UnhealthyThreshold: *e.UnhealthyThreshold,
Protocol: e.HealthCheckProtocol,
Path: e.HealthCheckPath,
},
}
for attr, val := range e.Attributes {View on GitHub (pinned to 4c8573c808)
Solutions
- Ensure the task-building code sets TargetGroup.VPC from the cluster's VPC task
- Regenerate the cluster spec with the stock kOps version for your release
- If shared (existing) target group, set Shared=true so the terraform path is skipped
Example fix
// before (task building)
tg := &awstasks.TargetGroup{Name: name, Port: &port}
// after
tg := &awstasks.TargetGroup{Name: name, Port: &port, VPC: vpcTask} Defensive patterns
Strategy: validation
Validate before calling
// before terraform target
if e.VPC == nil && !fi.ValueOf(e.Shared) {
return errors.New("target group has no VPC task; set VPC or mark Shared")
} Prevention
- Always wire VPC into TargetGroup tasks when building them
- Run `kops update cluster --target=terraform` early in CI to catch missing refs
- Use stock kOps task-building code
- Set Shared=true only for genuinely existing target groups
When it happens
Trigger: Running `kops update cluster --target=terraform` where the TargetGroup task was constructed without its VPC field populated — typically a wiring bug or a spec where the load balancer has no VPC association.
Common situations: Custom code or patched kOps building TargetGroup tasks manually without setting VPC; spec/feature changes that dropped the VPC assignment during task building; using terraform output on a cluster whose NLB spec is incomplete.
Related errors
- FindVPCInfo not implemented on azureCloud, use FindVNetInfo
- reconcile is not supported with terraform
- error deleting Subnet %q: %v
- error listing subnets: %v
- error detaching InternetGateway %q: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/cd836a414fa642d6.
Report an issue: GitHub.