{"record":{"id":"99710f88a5d451b2","repo":"kubernetes/kops","slug":"cloud-provider-digitalocean-requires-the-doterrafo","errorCode":null,"errorMessage":"cloud provider DigitalOcean requires the DOTerraform feature flag to enable the terraform target","messagePattern":"cloud provider DigitalOcean requires the DOTerraform feature flag to enable the terraform target","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/apply_cluster.go","lineNumber":172,"sourceCode":"}\n\nfunc (c *ApplyClusterCmd) Run(ctx context.Context) (*ApplyResults, error) {\n\tif c.TargetName == TargetTerraform {\n\t\tfound := false\n\t\tfor _, cp := range TerraformCloudProviders {\n\t\t\tif c.Cloud.ProviderID() == cp {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\treturn nil, fmt.Errorf(\"cloud provider %v does not support the terraform target\", c.Cloud.ProviderID())\n\t\t}\n\t\tif c.Cloud.ProviderID() == kops.CloudProviderAzure && !featureflag.AzureTerraform.Enabled() {\n\t\t\treturn nil, fmt.Errorf(\"cloud provider Azure requires the AzureTerraform feature flag to enable the terraform target\")\n\t\t}\n\t\tif c.Cloud.ProviderID() == kops.CloudProviderDO && !featureflag.DOTerraform.Enabled() {\n\t\t\treturn nil, fmt.Errorf(\"cloud provider DigitalOcean requires the DOTerraform feature flag to enable the terraform target\")\n\t\t}\n\t}\n\tif c.InstanceGroups == nil {\n\t\tlist, err := c.Clientset.InstanceGroupsFor(c.Cluster).List(ctx, metav1.ListOptions{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvar instanceGroups []*kops.InstanceGroup\n\t\tfor i := range list.Items {\n\t\t\tinstanceGroups = append(instanceGroups, &list.Items[i])\n\t\t}\n\t\tc.InstanceGroups = instanceGroups\n\t}\n\n\tif c.AdditionalObjects == nil {\n\t\tadditionalObjects, err := c.Clientset.AddonsFor(c.Cluster).List(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/apply_cluster.go#L154-L190","documentation":"Run() validates the terraform target against the selected cloud provider. DigitalOcean terraform support is gated behind the experimental DOTerraform feature flag; when the target is Terraform and the provider is DO and the flag is off, Run returns this error immediately. It is a deliberate opt-in guard, not a malfunction.","triggerScenarios":"Calling kops update cluster --target=terraform (or UpdateClusterOptions.Target=terraform) on a cluster whose spec sets cloudProvider=digitalocean while featureflag.DOTerraform is not enabled (no KOPS_FEATURE_FLAGS=Doterraform env var and no feature flag in the cluster spec).","commonSituations":"CI pipelines exporting DO clusters to terraform; teams switching an existing DO cluster from direct (TargetDirect) to terraform output for the first time; users upgrading kops to a version where DO terraform was gated behind the flag.","solutions":["Enable the flag: export KOPS_FEATURE_FLAGS=Doterraform (or add Doterraform to the existing feature flags list) and rerun the update.","Set the feature flag in the cluster spec: kops edit cluster and add 'Doterraform' under spec.featureFlags, then re-apply.","If terraform output is not actually required, use the default target instead of --target=terraform."],"exampleFix":"// before\nerr := applyCluster.Run(ctx)\n// after\nos.Setenv(\"KOPS_FEATURE_FLAGS\", \"Doterraform\")\n// or in the cluster spec:\n// spec:\n//   featureFlags:\n//     Doterraform: true","handlingStrategy":"validation","validationCode":"if opts.Target == fi.TargetTerraform && cluster.Spec.CloudProvider == string(kops.CloudProviderDO) && !featureflag.DOTerraform.Enabled() {\n    return fmt.Errorf(\"enable Doterraform feature flag before targeting terraform\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set KOPS_FEATURE_FLAGS=Doterraform in CI and dev shell profiles when working with DO clusters.","Document required feature flags next to the terraform export pipeline.","Validate target/provider combos in a preflight script before invoking kops."],"tags":["cloud-provider","digitalocean","terraform","feature-flag"],"backgroundTag":"feature-flag-not-enabled","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"}