Skip to content

Allow custom resource names via parameters for Microsoft Azure provider #211

@jamesbjackson

Description

@jamesbjackson

The reason for this request is that Microsoft has some best practise for Azure resource naming convention which can be seen here https://docs.microsoft.com/en-us/azure/architecture/best-practices/naming-conventions - So we trying to best follow this approach to naming our resources.

The issue is we can't over-ride the name currently as SparkleFormation always uses the generated name of the resource while if we use native JSON then it possible.

An example of what I am trying to archive is below. Any help to gain this functionality would be greatly appreciated, I been looking through the ruby code but not sure where best to add this functionality so could submit a PR.

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "vnetName": {
      "type": "string",
      "metadata": {
        "description": "Unique name of the virtual network"
      }
    },
    "vnetAddressPrefix": {
      "type": "string",
      "metadata": {
        "description": "Address blocks reserved for this virtual network in CDIR notation"
      }
    }
  },
  "variables": {
    "apiVersion": "2015-06-15"
  },
  "resources": [
    {
      "apiVersion": "[variables('apiVersion')]",
      "type": "Microsoft.Network/virtualNetworks",
      "name": "[parameters('vnetName')]",
      "location": "[resourceGroup().location]",
      "properties": {
        "addressSpace": {
          "addressPrefixes": [
            "[parameters('vnetAddressPrefix')]"
          ]  
        }
      }
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions