From 7613cedd055edf9940c45025f50100ec971cc300 Mon Sep 17 00:00:00 2001 From: Heng Lu Date: Wed, 15 Oct 2025 10:51:10 +0800 Subject: [PATCH 1/3] Fix example directory casing inconsistencies - Rename microsoft.insights_components_analyticsItems to Microsoft.Insights_components_analyticsItems - Rename microsoft.alertsManagement_smartDetectorAlertRules to Microsoft.AlertsManagement_smartDetectorAlertRules These directories had lowercase namespace prefixes which caused the sync-reference-doc tool to treat them as separate namespaces from their uppercase counterparts. This resulted in remarks.json files being overwritten, losing most samples during sync. After this fix, all 19 Microsoft.Insights examples and all 3 Microsoft.AlertsManagement examples are now properly synced together into their respective remarks.json files. Also updated output directory paths in GNUmakefile and sync-reference-doc/main.go from bicep-refdocs-generator to template-reference-generator. --- GNUmakefile | 4 ++-- .../main.tf | 0 .../main.tf | 0 tools/sync-reference-doc/main.go | 8 ++++---- 4 files changed, 6 insertions(+), 6 deletions(-) rename examples/{microsoft.alertsManagement_smartDetectorAlertRules@2019-06-01 => Microsoft.AlertsManagement_smartDetectorAlertRules@2019-06-01}/main.tf (100%) rename examples/{microsoft.insights_components_analyticsItems@2015-05-01 => Microsoft.Insights_components_analyticsItems@2015-05-01}/main.tf (100%) diff --git a/GNUmakefile b/GNUmakefile index c2c5c07ec..2878adfd7 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -124,9 +124,9 @@ example-test: # Run the sync-reference-doc tool to transform examples into the reference docs structure # Usage: # make sync-reference-doc -# make sync-reference-doc INDIR=examples OUTDIR=../bicep-refdocs-generator/settings/remarks RESOURCETYPES=tools/generator-example-doc/resource_types.json +# make sync-reference-doc INDIR=examples OUTDIR=../template-reference-generator/settings/remarks RESOURCETYPES=tools/generator-example-doc/resource_types.json INDIR ?= examples -OUTDIR ?= ../bicep-refdocs-generator/settings/remarks +OUTDIR ?= ../template-reference-generator/settings/remarks RESOURCETYPES ?= tools/generator-example-doc/resource_types.json sync-reference-doc: diff --git a/examples/microsoft.alertsManagement_smartDetectorAlertRules@2019-06-01/main.tf b/examples/Microsoft.AlertsManagement_smartDetectorAlertRules@2019-06-01/main.tf similarity index 100% rename from examples/microsoft.alertsManagement_smartDetectorAlertRules@2019-06-01/main.tf rename to examples/Microsoft.AlertsManagement_smartDetectorAlertRules@2019-06-01/main.tf diff --git a/examples/microsoft.insights_components_analyticsItems@2015-05-01/main.tf b/examples/Microsoft.Insights_components_analyticsItems@2015-05-01/main.tf similarity index 100% rename from examples/microsoft.insights_components_analyticsItems@2015-05-01/main.tf rename to examples/Microsoft.Insights_components_analyticsItems@2015-05-01/main.tf diff --git a/tools/sync-reference-doc/main.go b/tools/sync-reference-doc/main.go index 62d94759b..a23f0c86b 100644 --- a/tools/sync-reference-doc/main.go +++ b/tools/sync-reference-doc/main.go @@ -52,8 +52,8 @@ import ( // and generates/updates a remarks.json file per namespace next to the samples folder. // Default CLI values are determined dynamically based on where the tool is executed from. -// - If run from repo root: inDir = "examples", outDir = "../bicep-refdocs-generator/settings/remarks" -// - If run from tools/sync-reference-doc: inDir = "../../examples", outDir = "../../../bicep-refdocs-generator/settings/remarks" +// - If run from repo root: inDir = "examples", outDir = "../template-reference-generator/settings/remarks" +// - If run from tools/sync-reference-doc: inDir = "../../examples", outDir = "../../../template-reference-generator/settings/remarks" type sampleInfo struct { Namespace string // e.g. Microsoft.AlertsManagement @@ -89,11 +89,11 @@ func main() { switch filepath.Base(wd) { case "sync-reference-doc": defIn = filepath.Join(wd, "..", "..", "examples") - defOut = filepath.Join(wd, "..", "..", "..", "bicep-refdocs-generator", "settings", "remarks") + defOut = filepath.Join(wd, "..", "..", "..", "template-reference-generator", "settings", "remarks") resourceTypeJsonFile = filepath.Join(wd, "..", "generator-example-doc", "resource_types.json") case "terraform-provider-azapi": defIn = filepath.Join(wd, "examples") - defOut = filepath.Join(wd, "..", "bicep-refdocs-generator", "settings", "remarks") + defOut = filepath.Join(wd, "..", "template-reference-generator", "settings", "remarks") resourceTypeJsonFile = filepath.Join(wd, "tools", "generator-example-doc", "resource_types.json") default: } From da9c6492fb6b7e3cf5b2c4936c1bd4d95a1cd8f0 Mon Sep 17 00:00:00 2001 From: Heng Lu Date: Wed, 15 Oct 2025 10:55:30 +0800 Subject: [PATCH 2/3] make docs --- ...oft.alertsManagement_smartDetectorAlertRules.md | 12 ++++++------ ...microsoft.insights_components_analyticsItems.md | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/resources/microsoft.alertsManagement_smartDetectorAlertRules.md b/docs/resources/microsoft.alertsManagement_smartDetectorAlertRules.md index eef1654dd..396d62abb 100644 --- a/docs/resources/microsoft.alertsManagement_smartDetectorAlertRules.md +++ b/docs/resources/microsoft.alertsManagement_smartDetectorAlertRules.md @@ -1,11 +1,11 @@ --- -subcategory: "microsoft.alertsManagement - Azure Monitor" +subcategory: "Microsoft.AlertsManagement - Azure Monitor" page_title: "smartDetectorAlertRules" description: |- Manages a Monitor Smart Detector Alert Rule. --- -# microsoft.alertsManagement/smartDetectorAlertRules - Monitor Smart Detector Alert Rule +# Microsoft.AlertsManagement/smartDetectorAlertRules - Monitor Smart Detector Alert Rule This article demonstrates how to use `azapi` provider to manage the Monitor Smart Detector Alert Rule resource in Azure. @@ -140,14 +140,14 @@ resource "azapi_resource" "smartDetectorAlertRule" { The following arguments are supported: -* `type` - (Required) The type of the resource. This should be set to `microsoft.alertsManagement/smartDetectorAlertRules@api-version`. The available api-versions for this resource are: [`2019-03-01`, `2019-06-01`, `2021-04-01`]. +* `type` - (Required) The type of the resource. This should be set to `Microsoft.AlertsManagement/smartDetectorAlertRules@api-version`. The available api-versions for this resource are: [`2019-03-01`, `2019-06-01`, `2021-04-01`]. * `parent_id` - (Required) The ID of the azure resource in which this resource is created. The allowed values are: `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}` * `name` - (Required) Specifies the name of the azure resource. Changing this forces a new resource to be created. -* `body` - (Required) Specifies the configuration of the resource. More information about the arguments in `body` can be found in the [Microsoft documentation](https://learn.microsoft.com/en-us/azure/templates/microsoft.alertsManagement/smartDetectorAlertRules?pivots=deployment-language-terraform). +* `body` - (Required) Specifies the configuration of the resource. More information about the arguments in `body` can be found in the [Microsoft documentation](https://learn.microsoft.com/en-us/azure/templates/Microsoft.AlertsManagement/smartDetectorAlertRules?pivots=deployment-language-terraform). For other arguments, please refer to the [azapi_resource](https://registry.terraform.io/providers/Azure/azapi/latest/docs/resources/resource) documentation. @@ -155,8 +155,8 @@ For other arguments, please refer to the [azapi_resource](https://registry.terra ```shell # Azure resource can be imported using the resource id, e.g. - terraform import azapi_resource.example /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.alertsManagement/smartDetectorAlertRules/{resourceName} + terraform import azapi_resource.example /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/smartDetectorAlertRules/{resourceName} # It also supports specifying API version by using the resource id with api-version as a query parameter, e.g. - terraform import azapi_resource.example /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.alertsManagement/smartDetectorAlertRules/{resourceName}?api-version=2021-04-01 + terraform import azapi_resource.example /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/smartDetectorAlertRules/{resourceName}?api-version=2021-04-01 ``` diff --git a/docs/resources/microsoft.insights_components_analyticsItems.md b/docs/resources/microsoft.insights_components_analyticsItems.md index f98a04af0..45efc1656 100644 --- a/docs/resources/microsoft.insights_components_analyticsItems.md +++ b/docs/resources/microsoft.insights_components_analyticsItems.md @@ -1,11 +1,11 @@ --- -subcategory: "microsoft.insights - Azure Monitor" +subcategory: "Microsoft.Insights - Azure Monitor" page_title: "components/analyticsItems" description: |- Manages a Application Insights Analytics Item component. --- -# microsoft.insights/components/analyticsItems - Application Insights Analytics Item component +# Microsoft.Insights/components/analyticsItems - Application Insights Analytics Item component This article demonstrates how to use `azapi` provider to manage the Application Insights Analytics Item component resource in Azure. @@ -91,14 +91,14 @@ resource "azapi_resource_action" "analyticsItem" { The following arguments are supported: -* `type` - (Required) The type of the resource. This should be set to `microsoft.insights/components/analyticsItems@api-version`. The available api-versions for this resource are: [`2015-05-01`]. +* `type` - (Required) The type of the resource. This should be set to `Microsoft.Insights/components/analyticsItems@api-version`. The available api-versions for this resource are: [`2015-05-01`]. * `parent_id` - (Required) The ID of the azure resource in which this resource is created. The allowed values are: - `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}` + `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}` * `name` - (Required) Specifies the name of the azure resource. Changing this forces a new resource to be created. -* `body` - (Required) Specifies the configuration of the resource. More information about the arguments in `body` can be found in the [Microsoft documentation](https://learn.microsoft.com/en-us/azure/templates/microsoft.insights/components/analyticsItems?pivots=deployment-language-terraform). +* `body` - (Required) Specifies the configuration of the resource. More information about the arguments in `body` can be found in the [Microsoft documentation](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Insights/components/analyticsItems?pivots=deployment-language-terraform). For other arguments, please refer to the [azapi_resource](https://registry.terraform.io/providers/Azure/azapi/latest/docs/resources/resource) documentation. @@ -106,8 +106,8 @@ For other arguments, please refer to the [azapi_resource](https://registry.terra ```shell # Azure resource can be imported using the resource id, e.g. - terraform import azapi_resource.example /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/analyticsItems/{resourceName} + terraform import azapi_resource.example /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/analyticsItems/{resourceName} # It also supports specifying API version by using the resource id with api-version as a query parameter, e.g. - terraform import azapi_resource.example /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/analyticsItems/{resourceName}?api-version=2015-05-01 + terraform import azapi_resource.example /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/analyticsItems/{resourceName}?api-version=2015-05-01 ``` From 0ccdb56ca1be751f6e2b75f8c31602fc05e6f833 Mon Sep 17 00:00:00 2001 From: Heng Lu Date: Wed, 15 Oct 2025 11:49:44 +0800 Subject: [PATCH 3/3] Fix documentation file casing to match example directory names --- ...s.md => Microsoft.AlertsManagement_smartDetectorAlertRules.md} | 0 ...csItems.md => Microsoft.Insights_components_analyticsItems.md} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename docs/resources/{microsoft.alertsManagement_smartDetectorAlertRules.md => Microsoft.AlertsManagement_smartDetectorAlertRules.md} (100%) rename docs/resources/{microsoft.insights_components_analyticsItems.md => Microsoft.Insights_components_analyticsItems.md} (100%) diff --git a/docs/resources/microsoft.alertsManagement_smartDetectorAlertRules.md b/docs/resources/Microsoft.AlertsManagement_smartDetectorAlertRules.md similarity index 100% rename from docs/resources/microsoft.alertsManagement_smartDetectorAlertRules.md rename to docs/resources/Microsoft.AlertsManagement_smartDetectorAlertRules.md diff --git a/docs/resources/microsoft.insights_components_analyticsItems.md b/docs/resources/Microsoft.Insights_components_analyticsItems.md similarity index 100% rename from docs/resources/microsoft.insights_components_analyticsItems.md rename to docs/resources/Microsoft.Insights_components_analyticsItems.md