This document is no longer being maintained.
Please refer instead to Juju SDK docs | How to manage resources.
A Juju Charm Resource is additional content/files that a charm can make use of or may require in order to run.
There are two types of resources (specified in the
type key for each resource in the charm’s
oci-image. Support for resources type
file is available since
charmcraft 0.8.1+50, support for resources type
oci-images is expected in the following weeks.
To learn more about resources check these docs.
As resoures are declared in the charm’s
metadata.yaml file, they are intrinsically associated with the charm, and there’s no need to register them in Charmhub as a separate step (as long as a revision of the charm with a resource was uploaded to Charmhub, we’re ready to upload and do more work on that resource). Note that other charms may have resources using the same name, but this is not a problem, as collision will not happen because to reference a resource we always use both the charm and resource names.
So, for a charm to use a resource, we just need to upload it, and attach it when releasing the charm. Let’s see all the process in detail.