{"record":{"id":"15e30edb647d64de","repo":"kubernetes/kops","slug":"digitalocean-access-token-is-required-15e30e","errorCode":null,"errorMessage":"DIGITALOCEAN_ACCESS_TOKEN is required","messagePattern":"DIGITALOCEAN_ACCESS_TOKEN is required","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/nodeidentity/do/identify.go","lineNumber":90,"sourceCode":"\t\treturn nil, fmt.Errorf(\"failed to initialize digitalocean cloud: %s\", err)\n\t}\n\n\treturn &nodeIdentifier{\n\t\tdoClient:     doClient,\n\t\tcache:        expirationcache.NewTTLStore(stringKeyFunc, cacheTTL),\n\t\tcacheEnabled: cacheNodeidentityInfo,\n\t}, nil\n}\n\nfunc getMetadataRegion() (string, error) {\n\treturn getMetadata(dropletRegionMetadataURL)\n}\n\n// NewCloud returns a godo client, expecting the env var DIGITALOCEAN_ACCESS_TOKEN to be set.\nfunc NewCloud(region string) (*godo.Client, error) {\n\taccessToken := os.Getenv(\"DIGITALOCEAN_ACCESS_TOKEN\")\n\tif accessToken == \"\" {\n\t\treturn nil, errors.New(\"DIGITALOCEAN_ACCESS_TOKEN is required\")\n\t}\n\n\ttokenSource := &TokenSource{AccessToken: accessToken}\n\toauthClient := oauth2.NewClient(context.TODO(), tokenSource)\n\treturn godo.NewClient(oauthClient), nil\n}\n\nfunc getMetadata(url string) (string, error) {\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get metadata URL %s: %v\", url, err)\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"droplet metadata returned non-200 status code: %d\", resp.StatusCode)\n\t}","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/nodeidentity/do/identify.go#L72-L108","documentation":"Wraps a failure of awsBuildCloudInstanceGroup in getCloudGroups. After matching an ASG to a kops instance group, kOps builds a CloudInstanceGroup joining ASG members with Kubernetes nodes; a failure there (e.g. error resolving the ASG's launch configuration/template) is wrapped with the instance group name.","triggerScenarios":"awsBuildCloudInstanceGroup fails resolving the ASG's launch template/configuration: LaunchTemplateSpecification missing, describe-launch-template API error, or nil LaunchConfigurationName for legacy ASGs.","commonSituations":"ASG using a launch configuration on a kOps version expecting launch templates (or vice versa); ASG mutated externally; launch template deleted while ASG still references it during rolling-update listing.","solutions":["Check the ASG has a valid launch template or launch configuration in the AWS console","Upgrade/downgrade kOps to a version matching the cluster's launch template vs configuration setup","Re-create the ASG via `kops update cluster` if its launch template was deleted","Run `kops rolling-update cluster` after fixing to refresh group state"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"out, _ := cloud.Autoscaling().DescribeAutoScalingGroups(ctx, &autoscaling.DescribeAutoScalingGroupsInput{AutoScalingGroupNames: []string{asgName}})\ng := out.AutoScalingGroups[0]\nif g.LaunchTemplate == nil && g.MixedInstancesPolicy == nil && g.LaunchConfigurationName == nil { return fmt.Errorf(\"ASG %q has no launch spec\", asgName) }","typeGuard":"func hasLaunchSpec(g *autoscalingtypes.AutoScalingGroup) bool {\n  return g.LaunchTemplate != nil || (g.MixedInstancesPolicy != nil && g.MixedInstancesPolicy.LaunchTemplate != nil) || g.LaunchConfigurationName != nil\n}","tryCatchPattern":"groups, err := cloud.GetCloudGroups(ctx, cluster, igs, true, nodes)\nif err != nil && strings.Contains(err.Error(), \"error getting cloud instance group\") {\n  // repair the ASG's launch template via kops update cluster, then retry\n}","preventionTips":["Ensure all ASGs use launch templates matching the kOps version","Do not delete launch templates still referenced by ASGs","Avoid hand-editing ASGs outside kops/Terraform","Run `kops update cluster --dry-run` to detect drift"],"tags":["aws","autoscaling","launch-template"],"backgroundTag":"launch-template-resolution-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}