0

I am trying to manually code a ClearDB MySQL database resource within an ARM template to be of the 'Dedicated' type and of the 'Jupiter' tier, but I can't seem to find any documentation that shows how to do so within a template.

I know the ARM resource would look something like this:

  {
      "apiVersion": "2014-01-01",
      "name": "[variables('databaseName')]",
      "type": "SuccessBricks.ClearDB/databases",
      "plan": {
        "name": "Jupiter",
        "product": "databases",
        "publisher": "cleardb"
      },
      "location": "[resourceGroup().location]",
      "tags": {}
   }

but where is the property that defines whether the database is shared or dedicated?

Shui shengbao
  • 18,746
  • 3
  • 27
  • 45
LillaTheHun
  • 131
  • 1
  • 13

1 Answers1

1

I create the ClearDB MySQL database with different Database Types (Shared and Dedicated), and I check and compare the templates via Automation options.

enter image description here

Templates:

Database Type: Shared

{
    "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "cdbName": {
            "type": "string"
        },
        "cdbLocation": {
            "type": "string"
        },
        "cdbSku": {
            "type": "string"
        }
    },
    "resources": [
        {
            "apiVersion": "2014-04-01",
            "name": "[parameters('cdbName')]",
            "location": "[parameters('cdbLocation')]",
            "tags": {
                "provision_source": "RMS"
            },
            "type": "SuccessBricks.ClearDB/databases",
            "plan": {
                "name": "[parameters('cdbSku')]",
                "product": "databases",
                "publisher": "cleardb"
            }
        }
    ]
}

Database Type: Dedicated

{
    "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "cdbName": {
            "type": "string"
        },
        "cdbLocation": {
            "type": "string"
        },
        "cdbSku": {
            "type": "string"
        },
        "clusterName": {
            "type": "string"
        }
    },
    "resources": [
        {
            "apiVersion": "2014-04-01",
            "name": "[parameters('clusterName')]",
            "location": "[parameters('cdbLocation')]",
            "tags": {
                "provision_source": "RMS"
            },
            "type": "SuccessBricks.ClearDB/clusters",
            "plan": {
                "name": "[parameters('cdbSku')]",
                "product": "cluster",
                "publisher": "cleardb_clusters"
            }
        },
        {
            "apiVersion": "2014-04-01",
            "name": "xxxcleardbtest",
            "location": "[parameters('cdbLocation')]",
            "tags": {
                "provision_source": "RMS"
            },
            "type": "SuccessBricks.ClearDB/databases",
            "plan": {
                "name": "Free"
            },
            "dependsOn": [
                "[concat('SuccessBricks.ClearDB/clusters/', parameters('clusterName'))]"
            ],
            "properties": {
                "cluster": "/subscriptions/[object Object]/resourcegroups/xxxxxxxx/providers/SuccessBricks.ClearDB/clusters/DefaultCluster"
            }
        }
    ]
}

In Database Type: Dedicated template, we can find the resource SuccessBricks.ClearDB/databases is defined with a dependent (SuccessBricks.ClearDB/clusters) via dependsOn element. According to the template you provide, your database type is Shared.

Fei Han
  • 26,415
  • 1
  • 30
  • 41
  • So if I wanted to conditionally deploy either a shared or a dedicated type, would there be any way to do this without needing a nested template? For example: If "Dedicated" was passed as a parameter to this template, then deploy the Dedicated type -- Otherwise, deploy the shared – LillaTheHun Aug 24 '17 at 16:46
  • There is no concept of an ["If" statement](https://feedback.azure.com/forums/281804-azure-resource-manager/suggestions/11182812-if-else-conditions-in-resources) in ARM template at the moment, normally we can alter URL using parameters for our linked template to achieve conditional logic. – Fei Han Aug 25 '17 at 01:50