{"record":{"id":"e945df373d227927","repo":"kubernetes/kops","slug":"storage-profile-is-required-for-vmscaleset-q","errorCode":null,"errorMessage":"storage profile is required for VMScaleSet %q","messagePattern":"storage profile is required for VMScaleSet %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/azuretasks/vmscaleset_terraform.go","lineNumber":95,"sourceCode":"\tInstances                     *int64                                      `cty:\"instances\"`\n\tZones                         []string                                    `cty:\"zones\"`\n\tUpgradeMode                   *string                                     `cty:\"upgrade_mode\"`\n\tComputerNamePrefix            *string                                     `cty:\"computer_name_prefix\"`\n\tAdminUsername                 *string                                     `cty:\"admin_username\"`\n\tDisablePasswordAuthentication *bool                                       `cty:\"disable_password_authentication\"`\n\tAdminSSHKey                   []*terraformAzureVMScaleSetSSHKey           `cty:\"admin_ssh_key\"`\n\tSourceImageReference          *terraformAzureVMScaleSetImageReference     `cty:\"source_image_reference\"`\n\tSourceImageID                 *string                                     `cty:\"source_image_id\"`\n\tOSDisk                        *terraformAzureVMScaleSetOSDisk             `cty:\"os_disk\"`\n\tNetworkInterface              []*terraformAzureVMScaleSetNetworkInterface `cty:\"network_interface\"`\n\tIdentity                      *terraformAzureVMScaleSetIdentity           `cty:\"identity\"`\n\tUserData                      *terraformWriter.Literal                    `cty:\"user_data\"`\n\tTags                          map[string]string                           `cty:\"tags\"`\n}\n\nfunc (*VMScaleSet) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *VMScaleSet) error {\n\tif e.StorageProfile == nil || e.StorageProfile.VirtualMachineScaleSetStorageProfile == nil {\n\t\treturn fmt.Errorf(\"storage profile is required for VMScaleSet %q\", fi.ValueOf(e.Name))\n\t}\n\n\tstorageProfile := e.StorageProfile.VirtualMachineScaleSetStorageProfile\n\tif storageProfile.OSDisk == nil {\n\t\treturn fmt.Errorf(\"os disk is required for VMScaleSet %q\", fi.ValueOf(e.Name))\n\t}\n\n\tupgradeMode := string(compute.UpgradeModeManual)\n\tdisablePasswordAuthentication := true\n\ttf := &terraformAzureVMScaleSet{\n\t\tName:                          e.Name,\n\t\tResourceGroupName:             e.ResourceGroup.terraformName(),\n\t\tLocation:                      new(t.Cloud.Region()),\n\t\tSKU:                           e.SKUName,\n\t\tInstances:                     e.Capacity,\n\t\tZones:                         stringSlice(e.Zones),\n\t\tUpgradeMode:                   &upgradeMode,\n\t\tComputerNamePrefix:            e.ComputerNamePrefix,","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/azuretasks/vmscaleset_terraform.go#L77-L113","documentation":"RenderTerraform (terraform target for a VMScaleSet) requires the task's StorageProfile, including the embedded compute.VirtualMachineScaleSetStorageProfile, to be set because it is emitted verbatim into the Terraform azurerm_linux_virtual_machine_scale_set resource. A nil storage profile means kOps cannot generate a valid VMSS terraform block, so rendering fails with this error naming the scale set.","triggerScenarios":"RenderTerraform during `kops update cluster --target terraform` when the VMScaleSet task's e.StorageProfile or e.StorageProfile.VirtualMachineScaleSetStorageProfile is nil — i.e. the image/VM size plumbing upstream didn't populate the storage profile before rendering.","commonSituations":"Cluster spec missing image or machine type leading to an unset storage profile; a bug or recent refactor in the azure model builder; custom overrides clearing StorageProfile; running terraform target against a partially built model.","solutions":["Ensure the InstanceGroup/cluster spec defines a valid image and machineType, then regenerate: `kops update cluster --target terraform -f out.tf`.","Update kops to the latest patch — a missing storage profile from the model builder is usually a code bug; check kOps GitHub issues for your version.","If you registered a custom hook/override that clears StorageProfile, remove it and let the azure model populate it.","As a last resort, debug the model build path (pkg/model/azuremodel) to confirm the VMScaleSet task gets StorageProfile from the machine template."],"exampleFix":"// before\ne := &VMScaleSet{Name: name} // StorageProfile nil\n// after\ne := &VMScaleSet{\n  Name: name,\n  StorageProfile: &VMScaleSetStorageProfile{\n    VirtualMachineScaleSetStorageProfile: &compute.VirtualMachineScaleSetStorageProfile{\n      OSDisk: &compute.VirtualMachineScaleSetOSDisk{ /* ... */ },\n    },\n  },\n}","handlingStrategy":"validation","validationCode":"func (e *VMScaleSet) validateForTerraform() error {\n  if e.StorageProfile == nil || e.StorageProfile.VirtualMachineScaleSetStorageProfile == nil {\n    return fmt.Errorf(\"storage profile is required for VMScaleSet %q\", fi.ValueOf(e.Name))\n  }\n  if e.StorageProfile.VirtualMachineScaleSetStorageProfile.OSDisk == nil {\n    return fmt.Errorf(\"os disk is required for VMScaleSet %q\", fi.ValueOf(e.Name))\n  }\n  return nil\n}","typeGuard":"func hasStorageProfile(e *VMScaleSet) bool {\n  return e.StorageProfile != nil && e.StorageProfile.VirtualMachineScaleSetStorageProfile != nil\n}","tryCatchPattern":"err := vmssTask.RenderTerraform(target, a, e, changes)\nif err != nil && strings.Contains(err.Error(), \"storage profile is required\") {\n  // inspect cluster spec image/machineType, then rebuild the model\n  return fmt.Errorf(\"terraform render blocked: %w\", err)\n}","preventionTips":["Define image and machineType for every Azure instance group","Keep kops updated; missing storage profile is typically a model-builder bug","Do not clear StorageProfile via custom hooks","Run kops update cluster --target terraform in CI to catch rendering regressions"],"tags":["azure","vmss","terraform","storage-profile"],"backgroundTag":"vmss-storage-profile-missing","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"}