Resources in Humanitec


A Resource is something that is consumed or used by a Workload.
Examples of Resources include:
  • a PostgreSQL database used to store customer data,
  • a DNS name that a service is exposed to the internet with and
  • the Kubernetes Cluster the workload runs in.
Resources can be in-cluster - for example a Kubernetes Namespace that the workload runs in, or an Ingress Object that defines how the workload is reachable from outside the cluster. Many Resources are external to the cluster - for example a MySQL database running in an Amazon RDS instance or a DNS name configured in a Cloudflare Zone.
Developers define dependencies on resources in the Deployment Set. This allows a workload to consume the resource. Platform Teams create Resource Definitions that describe how and when to provision a resource.

Resource Types

Every Resource has a Resource Type. This defines the technology or class of object that the Resource represents. The distinction of a resource type is at the point of use by the workload. For example, a Resource with a mysql Resource Type represents a MySQL database. It does not matter if the instance hosting that database is provided by Amazon RDS, Google CloudSQL or a self managed instance running on a VM. What matters is that the workload can connect to the instance to access the database using a MySQL client.
A Resource Type provides a way of working with resources without worrying about how the actual resource is provisioned. Resource Types define a set of inputs and outputs that are specific to the technology they represent. The inputs are hints that a developer can give to how the resource should be provisioned. The outputs are parameters that the workload will need in order to make use of the resource.
If you are familiar with Object Orientated Programming (OOP), you can think of a Resource Type as an Interface or Base Class. The implementation of the resource can be changed without affecting the way a workload interacts with the resource.

Resource IDs

Every provisioned resource has an ID. The ID is unique to all resources of this type. This means that the tuple (combination of) Resource Type and Resource ID is unique for an Active Resource within an Environment.

Provisioning Resources

At deployment time, Humanitec identifies all of the resources that are needed to satisfy resource dependencies. For each resource identified, a Resource Definition is selected which describes which driver to use to provision the resource. The driver returns a set of Resource Outputs which can be injected into the workload via Placeholders.
Once a resource is provisioned, it is an Active Resource.
We use provision as a catch all term for "making resources available". In many cases, you will need to create a new thing - a new DNS name, a new database in an existing instance. However, there are also cases when you will want to provide something that already exists without creating a new thing. For example, in Production, you probably want your Application accessible by a fixed DNS name that you are managing. Rather than create a new subdomain automatically, the production environment should be accessible via a previously defined and configured DNS name.
It is important to remember that when we say provisioning, it does not necessarily mean that anything new has been created.

Further reading

Last modified 2mo ago