In the previous article, we explored how developers can make use of Humanitec's Resource system to avoid having to figure out how to provision and manage things their services depend on. In this and the subsequent articles we'll explain how you as Ops, DevOps, Platform Engineers or SREs can set Humanitec up to allow developers to self-serve the tech their services need.

If you have not read the first article, go back and read it. It introduces key concepts that we build on here.

What do you mean by "provision"?

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 app 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.

Drivers do the provisioning

Resources are ultimately provisioned by Resource Drivers. The job of Resource Drivers is to take the Resource Inputs for a particular Resource Type and produce the appropriate Resource Outputs. This may or may not involve creating the actual resource! For example a DNS driver would know how to provision a DNS name. This might involve creating a record in a DNS zonefile pointing at the IP address of a Load Balancer associated with a cluster. It might also simply involve knowing what DNS name to return as an output!

In order to make Resource Drivers more flexible, they can be parameterized with their own "Driver Inputs". For example, you might want to provide credentials to allow the driver to update the managed service it interacts with.

Resource Drivers are one of the most powerful extension points in Humanitec. We'll be devoting a whole article to them later in this series.

Defining how to provision resources

In order to provision a resource given just the type (say a new database of type postgres), we need a way of linking the Resource Type to a Driver and its Inputs. In Humanitec, this is done via a Resource Definition. The Resource Definition holds:

  • Resource Type
  • Driver
  • Driver Input

Given a Resource Definition and the appropriate Resource Inputs, a resource can be provisioned.

For example, the resource definition for our postgres resource might look like:

<p> CODE:<script src="https://gist.github.com/eskilavelon/d90728e1c25d544d4a3be460c1aa9c3b.js"></script>

Summary

  • Provisioning a resource does not necessarily mean something new is created.
  • Drivers produce the required Outputs for a Resource Type based on Resource and Driver Inputs.
  • Resource Definitions describe how to provision a resource by linking a ResourceType to a Driver and a set of Driver Inputs.

In the next blog post, we will discuss the other half of the resource provisioning problem: when to provision Resources.