Introduction

Resources are the building blocks that enable your workloads to run. The Humanitec Platform Orchestrator manages the provisioning and configuration of Resources through a declarative approach.

How do developers declare Resources

Developers use Score to declare the resources their workloads need to run. This is done in a score.yaml file:

# ...
  CONNECTION_STRING: postgresql://${resources.db.user}:${resources.db.password}@${resources.db.host}:${resources.db.port}/${resources.db.name}
# ...
resources:
  db:
    type: postgres

The Score file acts as the single source of truth for an workload’s runtime requirements. It describes dependencies like databases, storage, and caches.

How do platform teams provision Resources

Platform teams use Resources in the Humanitec Platform Orchestrator to actually provision the infrastructure declared in Score.

Resource Definitions match the Score requirements based on type, name, and labels. Definitions contain the provisioning logic and drivers to create the real infrastructure components.

For example:

// ...
    "db": {
      "type": "postgres"
    }
// ...
    "variables": {
      "CONNECTION_STRING": "postgresql://${resources.db.user}:${resources.db.password}@${resources.db.host}:${resources.db.port}/${resources.db.name}",
    }
// ..

This Resource Definition matches against any Dependent Resource of type postgres declared in Score. When a match occurs, the Postgres Driver provisions an Active Resource Postgres database instance.

The connection between Score’s declared needs and Resources enables turning those needs into provisioned infrastructure components. Developers declare requirements, platform teams author provisioning logic, and Active Resources are created to power applications.

What are the different types of Resources

Resources represent the components and services needed to run an application, like databases, object storage, DNS records, etc. The Platform Orchestrator manages the entire lifecycle of resources through a declarative approach.

The following are a high-level definition of Resources:

  • Resource Types - A category of resources like “database”, “object storage”, etc. Resource types are specified in dependent resources and definitions to allow matching between requirements and provisioning logic.
  • Resource Definitions - Contains the provisioning instructions and logic for a resource type. Resource definitions are authored by the platform team and matched against dependent resources.
  • Active Resources - The actual provisioned instances of resources. Active resources are provisioned based on matching a dependent resource to a resource definition.
  • Dependent Resources - Requirements declared in application and environment manifests. They define the resources an app needs.
  • Resource Graph - Maps relationships between resources to determine provisioning order based on dependencies. Ensures related resources are provisioned in the right sequence.

Why use Resources?

Resources provide many benefits:

  • Declarative Provisioning - Simply declare desired resources, versus manually configuring.
  • Reusable Definitions - Codify provisioning logic in definitions for reuse.
  • Automated Lifecycle - Resources are automatically created, updated, and deleted.
  • Dependency Management - Resource relationships are automatically wired.

Resources enable infrastructure-as-code through declarative provisioning in the Platform Orchestrator. Define app resources in YAML, and the platform provisions everything you need.

For more information on Resources, see the Resources Overview.

Top