A Juju resource is additional content/files that a charm can make use of or may require in order to run.
There are three ways to examine resources:
- Charm resources
- Application resources
- Unit resources
Each of these will be explained below.
Also see Developer resources in the Charm developer guide.
These are resources that the charm is defined with. They can be listed with the
charm-resources command. This will query the Charm Store by examining the
metadata.yaml file of the specified charm. The charm therefore does not need to have been deployed in order to run the command. A controller is also not strictly required but may be necessary in the case of private charms where credentials need to be added for authentication.
For example, to show the resources of the postgresql charm:
juju charm-resources postgresql
Resource Revision wal-e 0
These are resources that a deployed application is currently using across all its units and are discoverable with the
resources command. In contrast to the
charm-resources command, this command needs a controller (that it queries) as well as a deployed charm.
For example, to show the resources of the postgresql application:
juju resources postgresql
[Service] Resource Supplied by Revision wal-e charmstore 0
An application gains resources, typically by a charm developer, via the
juju attach-resource postgresql wal-e=/home/ubuntu/resources/wal-e-upgrade.snap
Where the charm’s
metadata.yaml file contains the following stanza:
"resources": "wal-e": "type": "file" "filename": "wal-e.snap" "description": "WAL-E Snap Package"
These are the resources that an individual unit (of an application) is currently using.
For example, to list the resources of unit ‘postgresql/0’:
juju resources postgresql/0
No resources to display.
Above we see the case where there is an absence of active resources at the unit level.