{"record":{"id":"7b87329da7a61617","repo":"kubernetes/kops","slug":"azure-storage-account-id-is-not-set-it-is-require","errorCode":null,"errorMessage":"Azure storage account ID is not set; it is required to render blob %q","messagePattern":"Azure storage account ID is not set; it is required to render blob %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/vfs/azureblob_terraform.go","lineNumber":46,"sourceCode":"\tStorageContainerID string                   `cty:\"storage_container_id\"`\n\tType               string                   `cty:\"type\"`\n\tSource             *terraformWriter.Literal `cty:\"source\"`\n\tProvider           *terraformWriter.Literal `cty:\"provider\"`\n}\n\nfunc (p *AzureBlobPath) RenderTerraform(w *terraformWriter.TerraformWriter, name string, data io.Reader, acl ACL) error {\n\tbytes, err := io.ReadAll(data)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"reading data: %w\", err)\n\t}\n\n\tw.EnsureTerraformProvider(\"azurerm\", map[string]string{})\n\n\tif p.account == \"\" {\n\t\treturn fmt.Errorf(\"Azure storage account is not set on path %q\", p.Path())\n\t}\n\tif w.AzureStorageAccountID == \"\" {\n\t\treturn fmt.Errorf(\"Azure storage account ID is not set; it is required to render blob %q\", p.Path())\n\t}\n\n\tsource, err := w.AddFilePath(\"azurerm_storage_blob\", name, \"source\", bytes, false)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"rendering Azure Blob file: %w\", err)\n\t}\n\n\ttf := &terraformAzureBlobFile{\n\t\tName:               p.key,\n\t\tStorageContainerID: w.AzureStorageAccountID + \"/blobServices/default/containers/\" + p.container,\n\t\tType:               \"Block\",\n\t\tSource:             source,\n\t\tProvider:           terraformWriter.LiteralTokens(\"azurerm\", \"files\"),\n\t}\n\treturn w.RenderResource(\"azurerm_storage_blob\", name, tf)\n}\n","sourceCodeStart":28,"sourceCodeEnd":63,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/vfs/azureblob_terraform.go#L28-L63","documentation":"The TerraformWriter requires AzureStorageAccountID to be populated before it can render an azurerm_storage_blob; it is used to compose the StorageContainerID (account + blobServices/default/containers/<name>). If the writer's AzureStorageAccountID field is empty, RenderTerraform aborts with this error naming the blob path.","triggerScenarios":"RenderTerraform called with a TerraformWriter whose AzureStorageAccountID was never set — typically because the writer was created by a code path that only populates it for Azure targets, or the cluster's Azure storage account/ID could not be resolved before rendering.","commonSituations":"Using kOps' terraform writer directly or via a non-Azure target that skipped Azure setup; cluster config lacks the Azure storage account ID; upgrading kOps versions where Azure writer initialization (EnsureTerraformProvider / Azure target setup) changed and ID assignment was skipped.","solutions":["Set w.AzureStorageAccountID to the Azure resource ID of the storage account before calling RenderTerraform","Ensure the kops Azure target populates AzureStorageAccountID (check target setup for the azurerm provider)","Verify the cluster spec's Azure storage account is defined so its ID can be resolved from Azure","Re-run the terraform render after the writer is properly initialized"],"exampleFix":"// before\nw := terraformWriter.NewTerraformWriter()\np.RenderTerraform(w, name, data, acl)\n\n// after\nw := terraformWriter.NewTerraformWriter()\nw.AzureStorageAccountID = \"/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Storage/storageAccounts/<account>\"\nif w.AzureStorageAccountID == \"\" {\n\treturn fmt.Errorf(\"cannot render blob: storage account ID unknown\")\n}\nreturn p.RenderTerraform(w, name, data, acl)","handlingStrategy":"validation","validationCode":"if w.AzureStorageAccountID == \"\" {\n\treturn fmt.Errorf(\"TerraformWriter.AzureStorageAccountID must be set to the account's Azure resource ID before rendering blobs\")\n}","typeGuard":null,"tryCatchPattern":"if err := p.RenderTerraform(w, name, data, acl); err != nil {\n\tif strings.Contains(err.Error(), \"storage account ID is not set\") {\n\t\treturn fmt.Errorf(\"initialize the Azure target so AzureStorageAccountID is populated: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Always construct the TerraformWriter through the kops Azure target setup, which assigns AzureStorageAccountID","Assert AzureStorageAccountID is non-empty in tests before rendering Azure blob resources","Keep the cluster's Azure storage account resource ID resolvable from the subscription config"],"tags":["azure","terraform","configuration","vfs"],"backgroundTag":"missing-config-value","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"}