{"record":{"id":"76dbb9b1f5e06e5b","repo":"kubernetes/kops","slug":"cloud-provider-azure-requires-the-azureterraform-f","errorCode":null,"errorMessage":"cloud provider Azure requires the AzureTerraform feature flag to enable the terraform target","messagePattern":"cloud provider Azure requires the AzureTerraform feature flag to enable the terraform target","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/apply_cluster.go","lineNumber":169,"sourceCode":"type ApplyResults struct {\n\t// AssetBuilder holds the initialized AssetBuilder, listing all the image and file assets.\n\tAssetBuilder *assets.AssetBuilder\n}\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 {","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/apply_cluster.go#L151-L187","documentation":"Even for supported providers, Run gates provider-specific terraform support behind feature flags: Azure requires featureflag.AzureTerraform and DigitalOcean requires featureflag.DOTerraform. When the flag is off, Run returns 'cloud provider Azure requires the AzureTerraform feature flag to enable the terraform target'.","triggerScenarios":"`kops update cluster --target=terraform` against an Azure cluster without KOPS_FEATURE_FLAGS containing AzureTerraform. Equivalent DO case triggers the sibling DOTerraform error.","commonSituations":"CI/CD pipelines generating terraform for Azure clusters after upgrading kOps where the flag became required; developers unaware the feature is alpha/behind a flag; env var set only in interactive shells but not in the pipeline.","solutions":["Enable the flag: `export KOPS_FEATURE_FLAGS=AzureTerraform` before running kops","Combine with other flags if needed: `KOPS_FEATURE_FLAGS=AzureTerraform,Spotinst`","Verify the flag is exported in CI (print env in the pipeline step)","Use --target=direct if terraform output is not strictly required"],"exampleFix":"// before\nkops update cluster azure-cluster --target=terraform --yes\n// after\nexport KOPS_FEATURE_FLAGS=AzureTerraform\nkops update cluster azure-cluster --target=terraform --yes","handlingStrategy":"validation","validationCode":"// gate on the flag before running terraform target\nif provider == \"azure\" && !featureflag.AzureTerraform.Enabled() {\n\treturn errors.New(\"set KOPS_FEATURE_FLAGS=AzureTerraform first\")\n}","typeGuard":null,"tryCatchPattern":"out, err := run(\"kops\", \"update\", \"cluster\", \"--target=terraform\", \"--yes\")\nif err != nil && strings.Contains(err.Error(), \"AzureTerraform feature flag\") {\n\tos.Setenv(\"KOPS_FEATURE_FLAGS\", \"AzureTerraform\")\n\treturn run(\"kops\", \"update\", \"cluster\", \"--target=terraform\", \"--yes\")\n}","preventionTips":["Export KOPS_FEATURE_FLAGS=AzureTerraform (or DOTerraform) in shell profiles and CI","Terraform targets for Azure/DO are gated alpha features — expect flag requirements","Print KOPS_FEATURE_FLAGS in CI logs to debug flag propagation","Enable the flag in every environment that runs the terraform target"],"tags":["terraform","azure","feature-flag","cli"],"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-12T12:17:11.808Z"}