kubernetes/kops · error
cloud provider %v does not support the terraform target
Error message
cloud provider %v does not support the terraform target
What it means
ApplyClusterCmd.Run validates that the selected --target=terraform is supported by the cluster's cloud provider. Only providers in TerraformCloudProviders (AWS, Azure, GCE, Hetzner, etc.) implement the terraform target; otherwise Run returns 'cloud provider %v does not support the terraform target'.
Source
Thrown at upup/pkg/fi/cloudup/apply_cluster.go:166
}
// ApplyResults holds information about an ApplyClusterCmd operation.
type ApplyResults struct {
// AssetBuilder holds the initialized AssetBuilder, listing all the image and file assets.
AssetBuilder *assets.AssetBuilder
}
func (c *ApplyClusterCmd) Run(ctx context.Context) (*ApplyResults, error) {
if c.TargetName == TargetTerraform {
found := false
for _, cp := range TerraformCloudProviders {
if c.Cloud.ProviderID() == cp {
found = true
break
}
}
if !found {
return nil, fmt.Errorf("cloud provider %v does not support the terraform target", c.Cloud.ProviderID())
}
if c.Cloud.ProviderID() == kops.CloudProviderAzure && !featureflag.AzureTerraform.Enabled() {
return nil, fmt.Errorf("cloud provider Azure requires the AzureTerraform feature flag to enable the terraform target")
}
if c.Cloud.ProviderID() == kops.CloudProviderDO && !featureflag.DOTerraform.Enabled() {
return nil, fmt.Errorf("cloud provider DigitalOcean requires the DOTerraform feature flag to enable the terraform target")
}
}
if c.InstanceGroups == nil {
list, err := c.Clientset.InstanceGroupsFor(c.Cluster).List(ctx, metav1.ListOptions{})
if err != nil {
return nil, err
}
var instanceGroups []*kops.InstanceGroup
for i := range list.Items {
instanceGroups = append(instanceGroups, &list.Items[i])
}
c.InstanceGroups = instanceGroupsView on GitHub (pinned to 4c8573c808)
Solutions
- Use --target=direct (default) or --target=dry-run for unsupported providers
- Check `grep TerraformCloudProviders` in your kOps version to confirm support; upgrade kOps if the provider recently gained terraform support
- For DigitalOcean, enable the DOTerraform feature flag: `export KOPS_FEATURE_FLAGS=DOTerraform`
- For Azure, enable the AzureTerraform feature flag (see next error) — this error precedes that check only for truly unsupported providers
Example fix
// before kops update cluster mycluster --target=terraform --yes // after (unsupported provider: use direct target) kops update cluster mycluster --target=direct --yes # or with kOps version that supports DO terraform: export KOPS_FEATURE_FLAGS=DOTerraform && kops update cluster mycluster --target=terraform
Defensive patterns
Strategy: validation
Validate before calling
// check provider support before invoking update
supported := map[kops.CloudProviderID]bool{
kops.CloudProviderAWS: true, kops.CloudProviderGCE: true,
kops.CloudProviderAzure: true, kops.CloudProviderHetzner: true,
}
if target == "terraform" && !supported[providerID] {
return fmt.Errorf("provider %s has no terraform target; use --target=direct", providerID)
} Type guard
func terraformSupported(id kops.CloudProviderID) bool {
for _, cp := range cloudup.TerraformCloudProviders {
if cp == id { return true }
}
return false
} Try / catch
out, err := run("kops", "update", "cluster", "--target=terraform", "--yes")
if err != nil && strings.Contains(err.Error(), "does not support the terraform target") {
return run("kops", "update", "cluster", "--target=direct", "--yes")
} Prevention
- Consult TerraformCloudProviders for your kOps version before choosing --target=terraform
- Default to --target=direct for providers without terraform support
- Upgrade kOps if your provider recently gained terraform support
- Pin the target in CI to match the cluster's cloudProvider
When it happens
Trigger: Running `kops update cluster --target=terraform` on a cluster whose cloudProvider is not in TerraformCloudProviders — e.g. DigitalOcean (without its flag it still fails only at the next check; unsupported ones like OpenStack, Metal, or Alibaba hit this error directly).
Common situations: Switching a cluster definition to a provider lacking terraform support while CI pipelines still run with --target=terraform; older kOps versions where the provider was not yet added to TerraformCloudProviders; typo'd/unsupported cloudProvider in the cluster spec.
Related errors
- reconcile is not supported with terraform
- cloud provider Azure requires the AzureTerraform feature fla
- cloud provider DigitalOcean requires the DOTerraform feature
- pass in the cloud provider explicitly using --cloud: %w
- DNS not implemented on azureCloud
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/44248264a35a817c.
Report an issue: GitHub.