You must add constraint tags to blueprints to match capabilities defined by your cloud administrator on resources, cloud zones, and profiles to generate appropriate deployments.

At the simplest level, you add constraint tags as YAML code to items in blueprints that match the capability tags that your cloud administrator created on resources, cloud zones and storage and network profiles. In addition, there are other more complex options for implementing constraint tags. For example, you can use a variable to populate one or more tags on a request. This enables you to specify one or more of the tags at request time.

See the provisioning funnel for more information about how Cloud Assembly processes and resolves capability and constraint tags.

How Constraint Tags Work in Blueprints

Create constraint tags by using the tag label in the blueprint YAML code.

Cloud Assembly supports a simple string formatting to make using constraints easier in YAML files:

[!]tag_key[:tag_value][:hard|:soft]

By default Cloud Assembly creates a positive constraint with hard enforcement. The tag value is optional (as in the rest of the application).

Hard constraints must be met in order for the resource capabilities to match the specified constraint. Soft constraints function like tie-breakers. If multiple resources match the hard constraints, the one that also matches the most soft constraints is chosen. This sort of tie breaker matching is based on a simple numeric comparison with no weighting.

The following WordPress with MySQL example shows YAML constraint tags that specific location information for compute resources.

name: "wordPressWithMySql"
components:
  mysql:
    type: "Compute"
    data:
      name: "mysql"
      # ... skipped lines ...
  wordpress:
    type: "Compute"
    data:
      name: "wordpress"
      instanceType: small
      imageType: "ubuntu-server-1604"
      constraints:
        - tag: "!location:eu:hard"
        - tag: "location:us:soft"
        - tag: "!pci"
      # ... skipped lines ...

For more information about how to work with blueprints, see WordPress Use Case: Create and Iteratively Develop a Blueprint.