How to use charm resources in a bundle

Bundles support charm resources (see Using resources) through the use of the resources key. Consider the following charm metadata.yaml file that includes a resource called pictures:

name: example-charm
summary: "example charm."
description: This is an example charm.
resources:
  pictures:
    type: file
    filename: pictures.zip
    description: "This charm needs pictures.zip to operate"

It might be desirable to use a specific resource revision in a bundle:

applications:
  example-charm:
   charm: "example-charm"
   series: trusty
   resources:
     pictures: 1

So here we specify a revision of ‘1’ from Charmhub.

The resources key can also specify a local path to a resource instead:

applications:
  example-charm:
   charm: "example-charm"
   series: trusty
   resources:
     pictures: "./pictures.zip"

Local resources can be useful in network restricted environments where the controller is unable to contact Charmhub.


Last updated 7 months ago.