As a blueprint developer, you use input parameters so that users can make custom selections at request time.

When users supply inputs, you no longer need to save multiple copies of blueprints that are only slightly different.

For example, you might create one blueprint for a MySQL database server, where users can deploy that one blueprint to different cloud resource environments and apply different capacity and credentials each time.

Input variables

How to create blueprint input parameters

Add an inputs section to your blueprint code, where you set the selectable values.

In the following example, machine size, operating system, and number of clustered servers are selectable.

inputs:
  size:
    type: string
    enum:
      - small
      - medium
    description: Size of Nodes
    title: Node Size
  image:
    type: string
    enum:
      - coreos
      - ubuntu
    title: Select Image/OS
  count:
    type: integer
    default: 2
    maximum: 5
    minimum: 2
    title: Wordpress Cluster Size
    description: Wordpress Cluster Size (Number of nodes)

Then, in the resources section, reference an input parameter using ${input.property-name} syntax.

Important: In blueprint code, you cannot use the word input except to indicate an input parameter.
resources:
  WebTier:
    type: Cloud.Machine
    properties:
      name: wordpress
      flavor: '${input.size}'
      image: '${input.image}'
      count: '${input.count}'

Input properties

Property Description
const Used with oneOf. The real value associated with the friendly title.
default Prepopulated value for the input.

The default must be of the correct type. Do not enter a word as the default for an integer.

description User help text for the input.
encrypted Whether to encrypt the input that the user enters, true or false.

Passwords are usually encrypted.

enum A drop-down menu of allowed values.

Use the following example as a format guide.

enum:
      - value 1
      - value 2
format Sets the expected format for the input. For example, (25/04/19) supports date-time.

Allows the use of the date picker in Service Broker custom forms.

items Declares items within an array. Supports number, integer, string, Boolean, or object.
maxItems Maximum number of selectable items within an array.
maxLength Maximum number of characters allowed for a string.

For example, to limit a field to 25 characters, enter maxLength: 25.

maximum Largest allowed value for a number or integer.
minItems Minimum number of selectable items within an array.
minLength Minimum number of characters allowed for a string.
minimum Smallest allowed value for a number or integer.
oneOf Allows the user input form to display a friendly name (title) for a less friendly value (const). If setting a default value, set the const, not the title.

Valid for use with types string, integer, and number.

pattern Allowable characters for string inputs, in regular expression syntax.

For example, '[a-z]+' or '[a-z0-9A-Z@#$]+'

properties Declares the key:value properties block for objects.
readOnly Used to provide a form label only.
title Used with oneOf. The friendly name for a const value. The title appears on the user input form at deployment time.
type Data type of number, integer, string, Boolean, or object.

writeOnly Hides keystrokes behind asterisks in the form. Cannot be used with enum. Appears as a password field in Service Broker custom forms.

Additional examples

String with enumeration

  image:
    type: string
    title: Operating System
    description: The operating system version to use.
    enum:
      - ubuntu 16.04
      - ubuntu 18.04
    default: ubuntu 16.04

  shell:
    type: string
    title: Default shell
    Description: The default shell that will be configured for the created user.
    enum:
      - /bin/bash
      - /bin/sh

Integer with minimum and maximum

  count:
    type: integer
    title: Machine Count
    description: The number of machines that you want to deploy.
    maximum: 5
    minimum: 1
    default: 1

Array of objects

  tags:
    type: array
    title: Tags
    description: Tags that you want applied to the machines.
    items:
      type: object
      properties:
        key:
          type: string
          title: Key
        value:
          type: string
          title: Value

String with friendly names

  platform:
    type: string
    oneOf:
      - title: AWS
        const: platform:aws
      - title: Azure
        const: platform:azure
      - title: vSphere
        const: platform:vsphere
    default: platform:aws

String with pattern validation

  username:
    type: string
    title: Username
    description: The name for the user that will be created when the machine is provisioned.
    pattern: ^[a-zA-Z]+$

String as password

  password:
    type: string
    title: Password
    description: The initial password that will be required to logon to the machine. Configured to reset on first login.
    writeOnly: true

String as text area

  ssh_public_key:
    type: string
    title: SSH public key
    maxLength: 256

Boolean

  public_ip:
    type: boolean
    title: Assign public IP address
    description: Choose whether your machine should be internet facing.
    default: false