Connect your resources to Humanitec

Overview

Humanitec is designed to integrate with your existing infrastructure. For example, it can be used to deploy apps to your own Kubernetes cluster, with a database provisioned in your own instance and made accessible via your own DNS name. This page explains how to connect your external resources to Humanitec using Static and Dynamic Resource Definitions.

Dynamic Resource Definition

Dynamic Resource Definitions specify a way for Humanitec to manage the full lifecycle of External Resources - creating them when needed and destroying them when they are no longer needed. This page explains how to add Dynamic Resource Definition and relate it to environments.

1. Add a Resource Account

Resource Accounts are the identities that are used to provision and manage External Resources. They can represent a range of identities including Cloud Provider Service Accounts, VPN Accounts and SSH accounts.

Currently Humanitec provides a user interface for adding a Google Cloud Platform account and API support for Amazon Web Services.

Add a GCP Account for PostgreSQL resource definition

Prerequisites

  • You must have a Service Account with the Cloud SQL Client role.
  • You must create a key for this service account in JSON form. See Google’s account keys documentation for more information. The access key must use the GCP Console/gcloud format (i.e., the first example in the linked documentation).
  • You must have the CloudSQL Admin API enabled for your project.

To add a Google Cloud platform account you need to:

  1. Click the Profile icon in the top right.
  2. Click Account Settings.
  3. On the Account Settings screen, click on your organization.
  4. Click on “Dynamic resources” tab.
  5. Select your service account (i.e. Google Cloud Platform). add-gcp-account
  6. The platform will ask you to provide an account name (a memorable name that will be displayed for this account) and a service account access key JSON (see prerequisites).
  7. Once you have added your account you will see the available Dynamic Resource Definitions.

gcp-account-added

2. Add a Dynamic Resource Definition

If you can’t see the needed resource or driver, contact us at [email protected] or learn how to add your own driver.

To add a Dynamic Resource Definition:

  1. Click on your Resource Account in Organisation settings, Dynamic Resources page.
  2. Click on the Resource type that you would like to add, in this example we will use PostgreSQL.
  3. Add a memorable ID for this Resource Definition and select a driver, here - cloudsql.
  4. Based on your resource driver, a form will be shown with the required driver parameters which will be passed to the driver on every resource creation. Add the values and click create.

add-dynamic-resource 5. Once created, the Resource Definition will appear in the list.

dynamic-resource-list 6. Assign your Resource Definition to an Environment Type.

dynamic-resource-to-env-type

Based on this Resource Definition, during the deployment on any of the matching environments, an Active Resource will be provisioned if required.

Static Resource Definition

Static Resource Definitions provide a way of using External Resources that are not managed by Humanitec. (Compared to Dynamic Resource Definitions where the lifecycle is managed by Humanitec).

This page explains how to add a Static Resource Definition and relate it to environments.

Add a Static Resource Definition

If you can’t see the needed resource or driver, contact us at [email protected].

To add a Static Resource Definition:

  1. Click the Profile icon in the top right.
  2. Click Account Settings.
  3. On the Account Settings screen, click on your organization.
  4. Click on “Static resources” tab.
  5. Select the Static Resource Definition that you want to add, in this example we will use DNS. choose-static-resource
  6. Add a memorable ID for this Static Resource Definition.
  7. Add the Values and Secrets and click create. add-static-resources
  8. Once created, the Static Resource Definition will appear in the list. list-static-resource
  9. Assign your Resource Definition to an Environment Type.

static-resource-to-env-type

Based on this Static Resource Definition, during the deployment on any of the matching environments, the data required for the application to access the resource is returned.