From d95e22f3baf0ddb40f1f2ce3ec88c0f2ee6d9b5c Mon Sep 17 00:00:00 2001 From: Nacho Alonso Portillo Date: Thu, 9 Jul 2026 14:58:26 +0200 Subject: [PATCH 1/4] [HorizonDB] Onboard Microsoft.HorizonDB --- .../remarks/microsoft.horizondb/remarks.json | 47 +++++++ .../samples/clusters/create.bicep | 37 +++++ .../samples/clusters/create.tf | 99 ++++++++++++++ .../clusters/pools/firewallrules/create.bicep | 35 +++++ .../clusters/pools/firewallrules/create.tf | 129 ++++++++++++++++++ .../update-administrator-login-password.bicep | 17 +++ .../update-administrator-login-password.tf | 54 ++++++++ .../samples/parametergroups/create.bicep | 40 ++++++ .../samples/parametergroups/create.tf | 95 +++++++++++++ 9 files changed, 553 insertions(+) create mode 100644 settings/remarks/microsoft.horizondb/remarks.json create mode 100644 settings/remarks/microsoft.horizondb/samples/clusters/create.bicep create mode 100644 settings/remarks/microsoft.horizondb/samples/clusters/create.tf create mode 100644 settings/remarks/microsoft.horizondb/samples/clusters/pools/firewallrules/create.bicep create mode 100644 settings/remarks/microsoft.horizondb/samples/clusters/pools/firewallrules/create.tf create mode 100644 settings/remarks/microsoft.horizondb/samples/clusters/update-administrator-login-password.bicep create mode 100644 settings/remarks/microsoft.horizondb/samples/clusters/update-administrator-login-password.tf create mode 100644 settings/remarks/microsoft.horizondb/samples/parametergroups/create.bicep create mode 100644 settings/remarks/microsoft.horizondb/samples/parametergroups/create.tf diff --git a/settings/remarks/microsoft.horizondb/remarks.json b/settings/remarks/microsoft.horizondb/remarks.json new file mode 100644 index 00000000..a6ea09cd --- /dev/null +++ b/settings/remarks/microsoft.horizondb/remarks.json @@ -0,0 +1,47 @@ +{ + "$schema": "../../schemas/remarks.schema.json", + "TerraformSamples": [ + { + "ResourceType": "Microsoft.HorizonDB/clusters", + "Path": "samples/clusters/create.tf", + "Description": "Create a cluster." + }, + { + "ResourceType": "Microsoft.HorizonDB/clusters", + "Path": "samples/clusters/update-administrator-login-password.tf", + "Description": "Update a cluster's administrator login password." + }, + { + "ResourceType": "Microsoft.HorizonDB/parameterGroups", + "Path": "samples/parametergroups/create.tf", + "Description": "Create a parameter group." + }, + { + "ResourceType": "Microsoft.HorizonDB/clusters/pools/firewallRules", + "Path": "samples/clusters/pools/firewallrules/create.tf", + "Description": "Create a firewall rule on a cluster." + } + ], + "BicepSamples": [ + { + "ResourceType": "Microsoft.HorizonDB/clusters", + "Path": "samples/clusters/create.bicep", + "Description": "Create a cluster." + }, + { + "ResourceType": "Microsoft.HorizonDB/clusters", + "Path": "samples/clusters/update-administrator-login-password.bicep", + "Description": "Update a cluster's administrator login password." + }, + { + "ResourceType": "Microsoft.HorizonDB/clusters/pools/firewallRules", + "Path": "samples/clusters/pools/firewallrules/create.bicep", + "Description": "Create a firewall rule on a cluster." + }, + { + "ResourceType": "Microsoft.HorizonDB/parameterGroups", + "Path": "samples/parametergroups/create.bicep", + "Description": "Create a parameter group." + } + ] +} \ No newline at end of file diff --git a/settings/remarks/microsoft.horizondb/samples/clusters/create.bicep b/settings/remarks/microsoft.horizondb/samples/clusters/create.bicep new file mode 100644 index 00000000..64c30bfb --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/clusters/create.bicep @@ -0,0 +1,37 @@ +@description('The location for the cluster') +param location string = 'eastus' +@description('The name for the cluster') +param clusterName string +@description('The tags for the cluster') +param tags object = { + env: 'dev' +} +@description('The create mode for cluster') +param createMode string = 'Create' +@description('The major version of server') +param version int = 17 +@description('The administrator login name for cluster') +param administratorLogin string +@secure() +@description('The administrator login password for cluster') +param administratorLoginPassword string +@description('The number of vCores for each replica of the cluster') +param vCores int = 4 +@description('The number of replicas for the cluster, including the primary replica, which is the only one in which writes are allowed. The other replicas are read-only.') +param replicaCount int = 2 +@description('The name of the SKU for cluster') +param zonePlacementPolicy string = 'BestEffort' +resource flexibleServer 'Microsoft.HorizonDB/clusters@2026-01-20-preview' = { + name: clusterName + location: location + tags: tags + properties: { + createMode: createMode + version: version + administratorLogin: administratorLogin + administratorLoginPassword: administratorLoginPassword + vCores: vCores + replicaCount: replicaCount + zonePlacementPolicy: zonePlacementPolicy + } +} diff --git a/settings/remarks/microsoft.horizondb/samples/clusters/create.tf b/settings/remarks/microsoft.horizondb/samples/clusters/create.tf new file mode 100644 index 00000000..7c37fc5d --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/clusters/create.tf @@ -0,0 +1,99 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "cluster_name" { + type = string + description = "The name for the cluster" +} + +variable "location" { + type = string + default = "eastus" + description = "The location for the cluster" +} + +variable "administrator_login" { + type = string + description = "The administrator login name for cluster" +} + +variable "administrator_login_password" { + type = string + description = "The administrator login password for cluster" + sensitive = true +} + +variable "create_mode" { + type = string + default = "Create" + description = "The create mode for cluster" +} + +variable "version" { + type = number + default = 17 + description = "The major version of server" +} + +variable "v_cores" { + type = number + default = 4 + description = "The number of vCores for each replica of the cluster" +} + +variable "replica_count" { + type = number + default = 2 + description = "The number of replicas for the cluster, including the primary replica, which is the only one in which writes are allowed. The other replicas are read-only." +} + +variable "zone_placement_policy" { + type = string + default = "BestEffort" + description = "The name of the SKU for cluster" +} + +variable "tags" { + type = object({ + env = optional(string) + }) + default = { + env = "dev" + } + description = "The tags for the cluster" +} + +resource "azapi_resource" "cluster" { + type = "Microsoft.HorizonDB/clusters@2026-01-20-preview" + name = var.cluster_name + location = var.location + parent_id = "/subscriptions/${data.azapi_client_config.current.subscription_id}/resourceGroups/${data.azapi_client_config.current.resource_group_name}" + + body = { + tags = var.tags + properties = { + createMode = var.create_mode + version = var.version + administratorLogin = var.administrator_login + administratorLoginPassword = var.administrator_login_password + vCores = var.v_cores + replicaCount = var.replica_count + zonePlacementPolicy = var.zone_placement_policy + } + } + + schema_validation_enabled = false + response_export_values = ["*"] +} + +data "azapi_client_config" "current" { +} diff --git a/settings/remarks/microsoft.horizondb/samples/clusters/pools/firewallrules/create.bicep b/settings/remarks/microsoft.horizondb/samples/clusters/pools/firewallrules/create.bicep new file mode 100644 index 00000000..9cd062c3 --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/clusters/pools/firewallrules/create.bicep @@ -0,0 +1,35 @@ +@description('The name for the cluster') +param clusterName string +@description('The name for the pool') +param poolName string = 'DefaultPool' +@description('The name for the firewall rule') +param firewallRuleName string = 'DataAnalyticsDepartment' +@description('The start IP address for the firewall rule') +param firewallRuleStartIp string = '10.0.0.1' +@description('The end IP address for the firewall rule') +param firewallRuleEndIp string = '10.0.0.10' +@description('The description for the firewall rule') +param firewallRuleDescription string = 'Allow all IP addresses from the Data Analytics department' +@description('The create mode for cluster') +param createMode string = 'Create' +@description('The major version of server') +param version int = 17 +@description('The administrator login name for cluster') +param administratorLogin string +@secure() +@description('The administrator login password for cluster') +param administratorLoginPassword string +@description('The number of vCores for each replica of the cluster') +param vCores int = 4 +@description('The number of replicas for the cluster, including the primary replica, which is the only one in which writes are allowed. The other replicas are read-only.') +param replicaCount int = 2 +@description('The name of the SKU for cluster') +param zonePlacementPolicy string = 'BestEffort' +resource flexibleServer 'Microsoft.HorizonDB/clusters/pools/firewallRules@2026-01-20-preview' = { + name: '${clusterName}/${poolName}/${firewallRuleName}' + properties: { + startIp: firewallRuleStartIp + endIp: firewallRuleEndIp + description: firewallRuleDescription + } +} diff --git a/settings/remarks/microsoft.horizondb/samples/clusters/pools/firewallrules/create.tf b/settings/remarks/microsoft.horizondb/samples/clusters/pools/firewallrules/create.tf new file mode 100644 index 00000000..7d1e3004 --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/clusters/pools/firewallrules/create.tf @@ -0,0 +1,129 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "cluster_name" { + type = string + description = "The name for the cluster" +} + +variable "pool_name" { + type = string + default = "DefaultPool" + description = "The name for the pool" +} + +variable "firewall_rule_name" { + type = string + default = "DataAnalyticsDepartment" + description = "The name for the firewall rule" +} + +variable "firewall_rule_start_ip" { + type = string + default = "10.0.0.1" + description = "The start IP address for the firewall rule" +} + +variable "firewall_rule_end_ip" { + type = string + default = "10.0.0.10" + description = "The end IP address for the firewall rule" +} + +variable "firewall_rule_description" { + type = string + default = "Allow all IP addresses from the Data Analytics department" + description = "The description for the firewall rule" +} + +variable "administrator_login" { + type = string + description = "The administrator login name for cluster" +} + +variable "administrator_login_password" { + type = string + description = "The administrator login password for cluster" + sensitive = true +} + +variable "create_mode" { + type = string + default = "Create" + description = "The create mode for cluster" +} + +variable "version" { + type = number + default = 17 + description = "The major version of server" +} + +variable "v_cores" { + type = number + default = 4 + description = "The number of vCores for each replica of the cluster" +} + +variable "replica_count" { + type = number + default = 2 + description = "The number of replicas for the cluster, including the primary replica, which is the only one in which writes are allowed. The other replicas are read-only." +} + +variable "zone_placement_policy" { + type = string + default = "BestEffort" + description = "The name of the SKU for cluster" +} + +data "azapi_client_config" "current" { +} + +resource "azapi_resource" "cluster" { + type = "Microsoft.HorizonDB/clusters@2026-01-20-preview" + name = var.cluster_name + parent_id = "/subscriptions/${data.azapi_client_config.current.subscription_id}/resourceGroups/${data.azapi_client_config.current.resource_group_name}" + + body = { + properties = { + createMode = var.create_mode + version = var.version + administratorLogin = var.administrator_login + administratorLoginPassword = var.administrator_login_password + vCores = var.v_cores + replicaCount = var.replica_count + zonePlacementPolicy = var.zone_placement_policy + } + } + + schema_validation_enabled = false + response_export_values = ["*"] +} + +resource "azapi_resource" "firewall_rule" { + type = "Microsoft.HorizonDB/clusters/pools/firewallRules@2026-01-20-preview" + parent_id = "${azapi_resource.cluster.id}/pools/${var.pool_name}" + name = var.firewall_rule_name + + body = { + properties = { + startIp = var.firewall_rule_start_ip + endIp = var.firewall_rule_end_ip + description = var.firewall_rule_description + } + } + + schema_validation_enabled = false + response_export_values = ["*"] +} + diff --git a/settings/remarks/microsoft.horizondb/samples/clusters/update-administrator-login-password.bicep b/settings/remarks/microsoft.horizondb/samples/clusters/update-administrator-login-password.bicep new file mode 100644 index 00000000..e4bac308 --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/clusters/update-administrator-login-password.bicep @@ -0,0 +1,17 @@ +@description('The location for the cluster') +param location string = 'eastus' +@description('The name for the cluster') +param clusterName string +@description('The create mode for cluster') +param createMode string = 'Update' +@secure() +@description('The administrator login password for cluster') +param administratorLoginPassword string +resource flexibleServer 'Microsoft.HorizonDB/clusters@2026-01-20-preview' = { + name: clusterName + location: location + properties: { + createMode: createMode + administratorLoginPassword: administratorLoginPassword + } +} diff --git a/settings/remarks/microsoft.horizondb/samples/clusters/update-administrator-login-password.tf b/settings/remarks/microsoft.horizondb/samples/clusters/update-administrator-login-password.tf new file mode 100644 index 00000000..4ee973be --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/clusters/update-administrator-login-password.tf @@ -0,0 +1,54 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "location" { + type = string + default = "eastus" + description = "The location for the cluster" +} + +variable "cluster_name" { + type = string + description = "The name for the cluster" +} + +variable "create_mode" { + type = string + default = "Update" + description = "The create mode for cluster" +} + +variable "administrator_login_password" { + type = string + description = "The administrator login password for cluster" + sensitive = true +} + +resource "azapi_resource" "cluster" { + type = "Microsoft.HorizonDB/clusters@2026-01-20-preview" + name = var.cluster_name + location = var.location + parent_id = "/subscriptions/${data.azapi_client_config.current.subscription_id}/resourceGroups/${data.azapi_client_config.current.resource_group_name}" + + body = { + properties = { + createMode = var.create_mode + administratorLoginPassword = var.administrator_login_password + } + } + + schema_validation_enabled = false + response_export_values = ["*"] +} + +data "azapi_client_config" "current" { +} diff --git a/settings/remarks/microsoft.horizondb/samples/parametergroups/create.bicep b/settings/remarks/microsoft.horizondb/samples/parametergroups/create.bicep new file mode 100644 index 00000000..92ac3998 --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/parametergroups/create.bicep @@ -0,0 +1,40 @@ +@description('The name for the parameter group') +param parameterGroupName string +@description('The location for the parameter group') +param location string = 'eastus' +@description('The tags for the parameter group') +param tags object = { + env: 'dev' +} +@description('The database parameters for the parameter group') +param parameters array = [ + { + name: 'max_connections' + value: '200' + } + { + name: 'log_min_error_statement' + value: 'error' + } + { + name: 'shared_buffers' + value: '2000' + } +] +@description('The description of the parameter group') +param parameterGroupDescription string = 'Parameter group for high-throughput workloads' +@description('The PostgreSQL version for the parameter group') +param pgVersion int = 17 +@description('Whether to apply changes immediately') +param applyImmediately bool = true +resource parameterGroup 'Microsoft.HorizonDB/parameterGroups@2026-01-20-preview' = { + name: parameterGroupName + location: location + tags: tags + properties: { + parameters: parameters + description: parameterGroupDescription + pgVersion: pgVersion + applyImmediately: applyImmediately + } +} diff --git a/settings/remarks/microsoft.horizondb/samples/parametergroups/create.tf b/settings/remarks/microsoft.horizondb/samples/parametergroups/create.tf new file mode 100644 index 00000000..468ab9f1 --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/parametergroups/create.tf @@ -0,0 +1,95 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "parameter_group_name" { + type = string + description = "The name for the parameter group" +} + +variable "location" { + type = string + default = "eastus" + description = "The location for the parameter group" +} + +variable "tags" { + type = object({ + env = optional(string) + }) + default = { + env = "dev" + } + description = "The tags for the parameter group" +} + +variable "pg_version" { + type = number + default = 17 + description = "The PostgreSQL version for the parameter group" +} + +variable "apply_immediately" { + type = bool + default = true + description = "Whether to apply changes immediately" +} + +variable "parameter_group_description" { + type = string + default = "Parameter group for high-throughput workloads" + description = "The description of the parameter group" +} + +variable "parameters" { + type = list(object({ + name = string + value = string + })) + default = [ + { + name = "max_connections" + value = "200" + }, + { + name = "log_min_error_statement" + value = "error" + }, + { + name = "shared_buffers" + value = "2000" + } + ] + description = "The database parameters for the parameter group" +} + +data "azapi_client_config" "current" { +} + +resource "azapi_resource" "parameter_group" { + type = "Microsoft.HorizonDB/parameterGroups@2026-01-20-preview" + name = var.parameter_group_name + location = var.location + parent_id = "/subscriptions/${data.azapi_client_config.current.subscription_id}/resourceGroups/${data.azapi_client_config.current.resource_group_name}" + + body = { + tags = var.tags + properties = { + parameters = var.parameters + description = var.parameter_group_description + pgVersion = var.pg_version + applyImmediately = var.apply_immediately + } + } + + schema_validation_enabled = false + response_export_values = ["*"] +} From f6ebf184f6612c4c5bd965273c8661c9f31800aa Mon Sep 17 00:00:00 2001 From: Nacho Alonso Portillo Date: Thu, 9 Jul 2026 15:25:33 +0200 Subject: [PATCH 2/4] Add Terraform and Bicep samples for scaling a cluster vertically in HorizonDB --- .../remarks/microsoft.horizondb/remarks.json | 10 ++++ .../clusters/scale-cluster-vertically.bicep | 16 ++++++ .../clusters/scale-cluster-vertically.tf | 54 +++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 settings/remarks/microsoft.horizondb/samples/clusters/scale-cluster-vertically.bicep create mode 100644 settings/remarks/microsoft.horizondb/samples/clusters/scale-cluster-vertically.tf diff --git a/settings/remarks/microsoft.horizondb/remarks.json b/settings/remarks/microsoft.horizondb/remarks.json index a6ea09cd..53d07599 100644 --- a/settings/remarks/microsoft.horizondb/remarks.json +++ b/settings/remarks/microsoft.horizondb/remarks.json @@ -11,6 +11,11 @@ "Path": "samples/clusters/update-administrator-login-password.tf", "Description": "Update a cluster's administrator login password." }, + { + "ResourceType": "Microsoft.HorizonDB/clusters", + "Path": "samples/clusters/scale-cluster-vertically.tf", + "Description": "Scale a cluster vertically." + }, { "ResourceType": "Microsoft.HorizonDB/parameterGroups", "Path": "samples/parametergroups/create.tf", @@ -33,6 +38,11 @@ "Path": "samples/clusters/update-administrator-login-password.bicep", "Description": "Update a cluster's administrator login password." }, + { + "ResourceType": "Microsoft.HorizonDB/clusters", + "Path": "samples/clusters/scale-cluster-vertically.bicep", + "Description": "Scale a cluster vertically." + }, { "ResourceType": "Microsoft.HorizonDB/clusters/pools/firewallRules", "Path": "samples/clusters/pools/firewallrules/create.bicep", diff --git a/settings/remarks/microsoft.horizondb/samples/clusters/scale-cluster-vertically.bicep b/settings/remarks/microsoft.horizondb/samples/clusters/scale-cluster-vertically.bicep new file mode 100644 index 00000000..596777bf --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/clusters/scale-cluster-vertically.bicep @@ -0,0 +1,16 @@ +@description('The location for the cluster') +param location string = 'eastus' +@description('The name for the cluster') +param clusterName string +@description('The create mode for cluster') +param createMode string = 'Update' +@description('The number of vCores for each replica of the cluster') +param vCores int = 8 +resource flexibleServer 'Microsoft.HorizonDB/clusters@2026-01-20-preview' = { + name: clusterName + location: location + properties: { + createMode: createMode + vCores: vCores + } +} diff --git a/settings/remarks/microsoft.horizondb/samples/clusters/scale-cluster-vertically.tf b/settings/remarks/microsoft.horizondb/samples/clusters/scale-cluster-vertically.tf new file mode 100644 index 00000000..2206a20d --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/clusters/scale-cluster-vertically.tf @@ -0,0 +1,54 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "location" { + type = string + default = "eastus" + description = "The location for the cluster" +} + +variable "cluster_name" { + type = string + description = "The name for the cluster" +} + +variable "create_mode" { + type = string + default = "Update" + description = "The create mode for cluster" +} + +variable "v_cores" { + type = number + default = 8 + description = "The number of vCores for each replica of the cluster" +} + +resource "azapi_resource" "cluster" { + type = "Microsoft.HorizonDB/clusters@2026-01-20-preview" + name = var.cluster_name + location = var.location + parent_id = "/subscriptions/${data.azapi_client_config.current.subscription_id}/resourceGroups/${data.azapi_client_config.current.resource_group_name}" + + body = { + properties = { + createMode = var.create_mode + vCores = var.v_cores + } + } + + schema_validation_enabled = false + response_export_values = ["*"] +} + +data "azapi_client_config" "current" { +} From ee7c037231a9df5e92bd85247f4d55e57e1ff100 Mon Sep 17 00:00:00 2001 From: Nacho Alonso Portillo Date: Thu, 9 Jul 2026 15:33:08 +0200 Subject: [PATCH 3/4] Add Terraform and Bicep samples for connecting a parameter group to a cluster in HorizonDB --- .../remarks/microsoft.horizondb/remarks.json | 16 +++++- .../connect-parameter-group-to-cluster.bicep | 18 ++++++ .../connect-parameter-group-to-cluster.tf | 55 +++++++++++++++++++ 3 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 settings/remarks/microsoft.horizondb/samples/clusters/connect-parameter-group-to-cluster.bicep create mode 100644 settings/remarks/microsoft.horizondb/samples/clusters/connect-parameter-group-to-cluster.tf diff --git a/settings/remarks/microsoft.horizondb/remarks.json b/settings/remarks/microsoft.horizondb/remarks.json index 53d07599..442f2a6e 100644 --- a/settings/remarks/microsoft.horizondb/remarks.json +++ b/settings/remarks/microsoft.horizondb/remarks.json @@ -16,6 +16,11 @@ "Path": "samples/clusters/scale-cluster-vertically.tf", "Description": "Scale a cluster vertically." }, + { + "ResourceType": "Microsoft.HorizonDB/clusters", + "Path": "samples/clusters/connect-parameter-group-to-cluster.tf", + "Description": "Connect a parameter group to a cluster." + }, { "ResourceType": "Microsoft.HorizonDB/parameterGroups", "Path": "samples/parametergroups/create.tf", @@ -44,14 +49,19 @@ "Description": "Scale a cluster vertically." }, { - "ResourceType": "Microsoft.HorizonDB/clusters/pools/firewallRules", - "Path": "samples/clusters/pools/firewallrules/create.bicep", - "Description": "Create a firewall rule on a cluster." + "ResourceType": "Microsoft.HorizonDB/clusters", + "Path": "samples/clusters/connect-parameter-group-to-cluster.bicep", + "Description": "Connect a parameter group to a cluster." }, { "ResourceType": "Microsoft.HorizonDB/parameterGroups", "Path": "samples/parametergroups/create.bicep", "Description": "Create a parameter group." + }, + { + "ResourceType": "Microsoft.HorizonDB/clusters/pools/firewallRules", + "Path": "samples/clusters/pools/firewallrules/create.bicep", + "Description": "Create a firewall rule on a cluster." } ] } \ No newline at end of file diff --git a/settings/remarks/microsoft.horizondb/samples/clusters/connect-parameter-group-to-cluster.bicep b/settings/remarks/microsoft.horizondb/samples/clusters/connect-parameter-group-to-cluster.bicep new file mode 100644 index 00000000..825bf38d --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/clusters/connect-parameter-group-to-cluster.bicep @@ -0,0 +1,18 @@ +@description('The location for the cluster') +param location string = 'eastus' +@description('The name for the cluster') +param clusterName string +@description('The create mode for cluster') +param createMode string = 'Update' +@description('The identifier of the parameter group to connect to the cluster') +param parameterGroupId string +resource flexibleServer 'Microsoft.HorizonDB/clusters@2026-01-20-preview' = { + name: clusterName + location: location + properties: { + createMode: createMode + parameterGroup: { + id: parameterGroupId + } + } +} diff --git a/settings/remarks/microsoft.horizondb/samples/clusters/connect-parameter-group-to-cluster.tf b/settings/remarks/microsoft.horizondb/samples/clusters/connect-parameter-group-to-cluster.tf new file mode 100644 index 00000000..6769c9c3 --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/clusters/connect-parameter-group-to-cluster.tf @@ -0,0 +1,55 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "location" { + type = string + default = "eastus" + description = "The location for the cluster" +} + +variable "cluster_name" { + type = string + description = "The name for the cluster" +} + +variable "create_mode" { + type = string + default = "Update" + description = "The create mode for cluster" +} + +variable "parameter_group_id" { + type = string + description = "The identifier of the parameter group to connect to the cluster" +} + +resource "azapi_resource" "cluster" { + type = "Microsoft.HorizonDB/clusters@2026-01-20-preview" + name = var.cluster_name + location = var.location + parent_id = "/subscriptions/${data.azapi_client_config.current.subscription_id}/resourceGroups/${data.azapi_client_config.current.resource_group_name}" + + body = { + properties = { + createMode = var.create_mode + parameterGroup = { + id = var.parameter_group_id + } + } + } + + schema_validation_enabled = false + response_export_values = ["*"] +} + +data "azapi_client_config" "current" { +} From 224f079a6d92b6d090cecc0a373baaa8e06831d9 Mon Sep 17 00:00:00 2001 From: Nacho Alonso Portillo Date: Thu, 9 Jul 2026 15:42:00 +0200 Subject: [PATCH 4/4] Add Terraform and Bicep samples for adding replicas with and without specific availability zones in HorizonDB --- .../remarks/microsoft.horizondb/remarks.json | 20 ++ .../add-no-specific-availability-zone.bicep | 17 ++ .../add-no-specific-availability-zone.tf | 170 +++++++++++++++++ .../add-specific-availability-zone.bicep | 14 ++ .../add-specific-availability-zone.tf | 177 ++++++++++++++++++ 5 files changed, 398 insertions(+) create mode 100644 settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-no-specific-availability-zone.bicep create mode 100644 settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-no-specific-availability-zone.tf create mode 100644 settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-specific-availability-zone.bicep create mode 100644 settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-specific-availability-zone.tf diff --git a/settings/remarks/microsoft.horizondb/remarks.json b/settings/remarks/microsoft.horizondb/remarks.json index 442f2a6e..8d588778 100644 --- a/settings/remarks/microsoft.horizondb/remarks.json +++ b/settings/remarks/microsoft.horizondb/remarks.json @@ -30,6 +30,16 @@ "ResourceType": "Microsoft.HorizonDB/clusters/pools/firewallRules", "Path": "samples/clusters/pools/firewallrules/create.tf", "Description": "Create a firewall rule on a cluster." + }, + { + "ResourceType": "Microsoft.HorizonDB/clusters/pools/replicas", + "Path": "samples/clusters/pools/replicas/add-no-specific-availability-zone.tf", + "Description": "Add a replica without a specific availability zone to a pool." + }, + { + "ResourceType": "Microsoft.HorizonDB/clusters/pools/replicas", + "Path": "samples/clusters/pools/replicas/add-specific-availability-zone.tf", + "Description": "Add a replica in a specific availability zone to a pool." } ], "BicepSamples": [ @@ -62,6 +72,16 @@ "ResourceType": "Microsoft.HorizonDB/clusters/pools/firewallRules", "Path": "samples/clusters/pools/firewallrules/create.bicep", "Description": "Create a firewall rule on a cluster." + }, + { + "ResourceType": "Microsoft.HorizonDB/clusters/pools/replicas", + "Path": "samples/clusters/pools/replicas/add-no-specific-availability-zone.bicep", + "Description": "Add a replica without a specific availability zone to a pool." + }, + { + "ResourceType": "Microsoft.HorizonDB/clusters/pools/replicas", + "Path": "samples/clusters/pools/replicas/add-specific-availability-zone.bicep", + "Description": "Add a replica in a specific availability zone to a pool." } ] } \ No newline at end of file diff --git a/settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-no-specific-availability-zone.bicep b/settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-no-specific-availability-zone.bicep new file mode 100644 index 00000000..5c220421 --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-no-specific-availability-zone.bicep @@ -0,0 +1,17 @@ +@description('The name for the cluster') +param clusterName string +@description('The name for the pool') +param poolName string = 'DefaultPool' +@description('The name for the replica') +param replicaName string +@description('The role for the replica') +param role string = 'Read' +@description('The availability zone for the replica') +param availabilityZone string = '1' +resource replica 'Microsoft.HorizonDB/clusters/pools/replicas@2026-01-20-preview' = { + name: '${clusterName}/${poolName}/${replicaName}' + properties: { + role: role + availabilityZone: availabilityZone + } +} diff --git a/settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-no-specific-availability-zone.tf b/settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-no-specific-availability-zone.tf new file mode 100644 index 00000000..92c686a2 --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-no-specific-availability-zone.tf @@ -0,0 +1,170 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "cluster_name" { + type = string + description = "The name for the cluster" +} + +variable "pool_name" { + type = string + default = "DefaultPool" + description = "The name for the pool" +} + +variable "replica_name" { + type = string + description = "The name for the replica" +} + +variable "role" { + type = string + default = "Read" + description = "The role for the replica" +} + +data "azapi_client_config" "current" { +} + +resource "azapi_resource" "replica" { + type = "Microsoft.HorizonDB/clusters/pools/replicas@2026-01-20-preview" + name = var.replica_name + parent_id = "/subscriptions/${data.azapi_client_config.current.subscription_id}/resourceGroups/${data.azapi_client_config.current.resource_group_name}/providers/Microsoft.HorizonDB/clusters/${var.cluster_name}/pools/${var.pool_name}" + + body = { + properties = { + role = var.role + } + } + + schema_validation_enabled = false + response_export_values = ["*"] +} + + +variable "cluster_name" { + type = string + description = "The name for the cluster" +} + +variable "pool_name" { + type = string + default = "DefaultPool" + description = "The name for the pool" +} + +variable "firewall_rule_name" { + type = string + default = "DataAnalyticsDepartment" + description = "The name for the firewall rule" +} + +variable "firewall_rule_start_ip" { + type = string + default = "10.0.0.1" + description = "The start IP address for the firewall rule" +} + +variable "firewall_rule_end_ip" { + type = string + default = "10.0.0.10" + description = "The end IP address for the firewall rule" +} + +variable "firewall_rule_description" { + type = string + default = "Allow all IP addresses from the Data Analytics department" + description = "The description for the firewall rule" +} + +variable "administrator_login" { + type = string + description = "The administrator login name for cluster" +} + +variable "administrator_login_password" { + type = string + description = "The administrator login password for cluster" + sensitive = true +} + +variable "create_mode" { + type = string + default = "Create" + description = "The create mode for cluster" +} + +variable "version" { + type = number + default = 17 + description = "The major version of server" +} + +variable "v_cores" { + type = number + default = 4 + description = "The number of vCores for each replica of the cluster" +} + +variable "replica_count" { + type = number + default = 2 + description = "The number of replicas for the cluster, including the primary replica, which is the only one in which writes are allowed. The other replicas are read-only." +} + +variable "zone_placement_policy" { + type = string + default = "BestEffort" + description = "The name of the SKU for cluster" +} + +data "azapi_client_config" "current" { +} + +resource "azapi_resource" "cluster" { + type = "Microsoft.HorizonDB/clusters@2026-01-20-preview" + name = var.cluster_name + parent_id = "/subscriptions/${data.azapi_client_config.current.subscription_id}/resourceGroups/${data.azapi_client_config.current.resource_group_name}" + + body = { + properties = { + createMode = var.create_mode + version = var.version + administratorLogin = var.administrator_login + administratorLoginPassword = var.administrator_login_password + vCores = var.v_cores + replicaCount = var.replica_count + zonePlacementPolicy = var.zone_placement_policy + } + } + + schema_validation_enabled = false + response_export_values = ["*"] +} + +resource "azapi_resource" "firewall_rule" { + type = "Microsoft.HorizonDB/clusters/pools/firewallRules@2026-01-20-preview" + parent_id = "${azapi_resource.cluster.id}/pools/${var.pool_name}" + name = var.firewall_rule_name + + body = { + properties = { + startIp = var.firewall_rule_start_ip + endIp = var.firewall_rule_end_ip + description = var.firewall_rule_description + } + } + + schema_validation_enabled = false + response_export_values = ["*"] +} + diff --git a/settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-specific-availability-zone.bicep b/settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-specific-availability-zone.bicep new file mode 100644 index 00000000..b4f7bfd9 --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-specific-availability-zone.bicep @@ -0,0 +1,14 @@ +@description('The name for the cluster') +param clusterName string +@description('The name for the pool') +param poolName string = 'DefaultPool' +@description('The name for the replica') +param replicaName string +@description('The role for the replica') +param role string = 'Read' +resource replica 'Microsoft.HorizonDB/clusters/pools/replicas@2026-01-20-preview' = { + name: '${clusterName}/${poolName}/${replicaName}' + properties: { + role: role + } +} diff --git a/settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-specific-availability-zone.tf b/settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-specific-availability-zone.tf new file mode 100644 index 00000000..34f04b78 --- /dev/null +++ b/settings/remarks/microsoft.horizondb/samples/clusters/pools/replicas/add-specific-availability-zone.tf @@ -0,0 +1,177 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "cluster_name" { + type = string + description = "The name for the cluster" +} + +variable "pool_name" { + type = string + default = "DefaultPool" + description = "The name for the pool" +} + +variable "replica_name" { + type = string + description = "The name for the replica" +} + +variable "role" { + type = string + default = "Read" + description = "The role for the replica" +} + +variable "availability_zone" { + type = string + default = "1" + description = "The availability zone for the replica" +} + +data "azapi_client_config" "current" { +} + +resource "azapi_resource" "replica" { + type = "Microsoft.HorizonDB/clusters/pools/replicas@2026-01-20-preview" + name = var.replica_name + parent_id = "/subscriptions/${data.azapi_client_config.current.subscription_id}/resourceGroups/${data.azapi_client_config.current.resource_group_name}/providers/Microsoft.HorizonDB/clusters/${var.cluster_name}/pools/${var.pool_name}" + + body = { + properties = { + role = var.role + availabilityZone = var.availability_zone + } + } + + schema_validation_enabled = false + response_export_values = ["*"] +} + + +variable "cluster_name" { + type = string + description = "The name for the cluster" +} + +variable "pool_name" { + type = string + default = "DefaultPool" + description = "The name for the pool" +} + +variable "firewall_rule_name" { + type = string + default = "DataAnalyticsDepartment" + description = "The name for the firewall rule" +} + +variable "firewall_rule_start_ip" { + type = string + default = "10.0.0.1" + description = "The start IP address for the firewall rule" +} + +variable "firewall_rule_end_ip" { + type = string + default = "10.0.0.10" + description = "The end IP address for the firewall rule" +} + +variable "firewall_rule_description" { + type = string + default = "Allow all IP addresses from the Data Analytics department" + description = "The description for the firewall rule" +} + +variable "administrator_login" { + type = string + description = "The administrator login name for cluster" +} + +variable "administrator_login_password" { + type = string + description = "The administrator login password for cluster" + sensitive = true +} + +variable "create_mode" { + type = string + default = "Create" + description = "The create mode for cluster" +} + +variable "version" { + type = number + default = 17 + description = "The major version of server" +} + +variable "v_cores" { + type = number + default = 4 + description = "The number of vCores for each replica of the cluster" +} + +variable "replica_count" { + type = number + default = 2 + description = "The number of replicas for the cluster, including the primary replica, which is the only one in which writes are allowed. The other replicas are read-only." +} + +variable "zone_placement_policy" { + type = string + default = "BestEffort" + description = "The name of the SKU for cluster" +} + +data "azapi_client_config" "current" { +} + +resource "azapi_resource" "cluster" { + type = "Microsoft.HorizonDB/clusters@2026-01-20-preview" + name = var.cluster_name + parent_id = "/subscriptions/${data.azapi_client_config.current.subscription_id}/resourceGroups/${data.azapi_client_config.current.resource_group_name}" + + body = { + properties = { + createMode = var.create_mode + version = var.version + administratorLogin = var.administrator_login + administratorLoginPassword = var.administrator_login_password + vCores = var.v_cores + replicaCount = var.replica_count + zonePlacementPolicy = var.zone_placement_policy + } + } + + schema_validation_enabled = false + response_export_values = ["*"] +} + +resource "azapi_resource" "firewall_rule" { + type = "Microsoft.HorizonDB/clusters/pools/firewallRules@2026-01-20-preview" + parent_id = "${azapi_resource.cluster.id}/pools/${var.pool_name}" + name = var.firewall_rule_name + + body = { + properties = { + startIp = var.firewall_rule_start_ip + endIp = var.firewall_rule_end_ip + description = var.firewall_rule_description + } + } + + schema_validation_enabled = false + response_export_values = ["*"] +} +