Git Product home page Git Product logo

armm-module-demo's Introduction

Modules

Definition

A module is a jsonnet library that, when evaluated, yields an object conforming to the following subset of attributes of an ARM template:

{
    resources: [
        { <resource definition> }
    ],

    outputs: {
        ...: {
            ...
        }
        ...
    }
}

(In fact, an existing ARM template intended for inline use is a valid Module per this definition)

A module can be parameterized. Argument values are passed to the module by injecting a 'parameters' environment variable into the execution environment (equivaluent of passing a ext-str parameters=... to the jsonnet cli)

Conventions

In addition to the core definition of a module, there are several conventions that, when followed, provide surrounding tooling with additional information/capabilities.

Introspection/module metadata

A module may declare parameters that it supports by providing a parmameterMetadata attribute. The parameterMetadata attribute includes the name, type and default value for parameters. TODO: additional functionality can be added to parameterMetadata, including imperative validation, descriptions, enum values etc.)

Example:

{
    parameterMetadata:: {
        stringValue: {
            type: 'string'
        },
        optionalIntegerValue: {
            type: 'number',
            defaultValue: 7
        }
    }
}

A caller may inspect what arguments a module provides by examining the parameterMetadata field of the module. The parameterMetadata can also be used by the module (or caller) to validate the provided parameters.

TODO: if we rename parameterMetadata to parameters, and make sure we follow the same schema as an ARM template's parameters section, we have an ever stronger correlation between ARM templates and Modules. This way, we'd also make it a formal part of a module definition rather than a convention

Id field

In many cases, a module logically defines a root (anchor) resource with a set of dependent resources. A module may chose to expose this id to other modules by providing a top level id attribute.

Platform libraries

Module base implementation

A module author may take advantage of a core module definition that provides validation of parameters based on parameterMetadata.

Resource base implementation

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.