Coder Social home page Coder Social logo

armlinker's Introduction

Overview

ARM Templates does not support local and relative paths. The only way to link to other files is to put them online.
This tool expects local and/or relative paths and merges your ARM templates into a one template.
A fuller narrative with example usage can be read on my blog here.

Install

install-module ARMLinker

PowerShell Usage

import-module ARMLinker
Convert-TemplateLinks -InputPath <path to main template> [-OutputPath <path to output file>]

If no output path is specified, the merged JSON is written to output.

Example input/output

azuredeploy.linked.json

{
    "$schema": "https//schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "parameters": {},
    "resources": [
        {
            "templateLink": {
                "uri": "./aresource.json"
            }
        }
    ]
}

aresource.json

{
    "type": "Microsoft.Web/connections",
    "apiVersion": "2016-06-01",
    "properties": "..."
}

Running Convert-TemplateLinks azuredeploy.linked.json azuredeploy.json will output a merged version of the two in a file called azuredeploy.json:

{
    "$schema": "https//schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "parameters": {},
    "resources": [
        {
            "type": "Microsoft.Web/connections",
            "apiVersion": "2016-06-01",
            "proper": "properties were probably here"
        }
    ]
}

If the JSON you want to link is at some deeper level in the linked JSON, you can specify a "jsonPath" as well:

azuredeploy.linked.json

{
    "$schema": "https//schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "parameters": {},
    "resources": [
        {
            "templateLink": {
                "uri": "./aresource.json",
                "jsonPath": "special.path"
            }
        }
    ]
}

aresource.json

{
    "special": {
        "path": {
            "type": "Microsoft.Web/connections",
            "apiVersion": "2016-06-01",
            "properties": "..."
        }
    }
}

Incidentally...

This works with any JSON, but the main goal is for ARM templates.
Hence following the same convension as the supported "full online URL" feature.

armlinker's People

Contributors

lars-erik avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.