kubernetes/kops · error

error parsing CIDR subnet: %v

Error message

error parsing CIDR subnet: %v

What it means

During Terraform rendering, the subnet's IPv6 CIDR allocation hint ('/size,netnum' notation) failed utils.ParseCIDRNotation; the spec carries a malformed subnet IPv6 hint, so no concrete CIDR can be computed.

Source

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

		}
	}

	shared := fi.ValueOf(e.Shared)
	if shared {
		// Not terraform owned / managed
		// We won't apply changes, but our validation (kops update) will still warn
		//
		// We probably shouldn't output subnet_ids only in this case - we normally output them by role,
		// but removing it now might break people.  We could always output subnet_ids though, if we
		// ever get a request for that.
		return t.AddOutputVariableArray("subnet_ids", terraformWriter.LiteralFromStringValue(*e.ID))
	}

	var ipv6CIDR *terraformWriter.Literal
	if strings.HasPrefix(aws.ToString(e.IPv6CIDR), "/") {
		newSize, netNum, err := utils.ParseCIDRNotation(*e.IPv6CIDR)
		if err != nil {
			return fmt.Errorf("error parsing CIDR subnet: %v", err)
		}

		newBits := terraformWriter.LiteralBinaryExpression(
			terraformWriter.LiteralFromIntValue(newSize),
			"-",
			terraformWriter.LiteralTokens("local", "vpc_ipv6_cidr_length"),
		)
		ipv6CIDR = terraformWriter.LiteralFunctionExpression("cidrsubnet",
			terraformWriter.LiteralTokens("local", "vpc_ipv6_cidr_block"),
			newBits,
			terraformWriter.LiteralFromIntValue(netNum),
		)
	} else if e.IPv6CIDR != nil {
		ipv6CIDR = terraformWriter.LiteralFromStringValue(aws.ToString(e.IPv6CIDR))
	}

	tf := &terraformSubnet{
		VPCID:            e.VPC.TerraformLink(),

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Fix the IPv6 CIDR hint in the cluster spec to the form '/<prefix>,<netnum>' (e.g. '/64,5')
  2. Or remove the hint so kOps allocates automatically
Defensive patterns

Strategy: validation

When it happens

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