Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Add missing docs for humanitec app connection endpoints

carlosmonastyrskif15e61dbd95f
diff --git a/backend/src/services/app-connection/humanitec/humanitec-connection-fns.ts b/backend/src/services/app-connection/humanitec/humanitec-connection-fns.ts
index 5775e5b248..55094629b6 100644
--- a/backend/src/services/app-connection/humanitec/humanitec-connection-fns.ts
+++ b/backend/src/services/app-connection/humanitec/humanitec-connection-fns.ts
@@ -84,21 +84,17 @@ export const listOrganizations = async (appConnection: THumanitecConnection): Pr
}
);
- if (!appsResponse.data) {
- throw new InternalServerError({
- message: "Failed to get apps for organization: Response was empty"
+ if (appsResponse.data) {
+ const apps = appsResponse.data;
+ orgsWithApps.push({
+ ...org,
+ apps: apps.map((app) => ({
+ name: app.name,
+ id: app.id,
+ envs: app.envs
+ }))
});
}
-
- const apps = appsResponse.data;
- orgsWithApps.push({
- ...org,
- apps: apps.map((app) => ({
- name: app.name,
- id: app.id,
- envs: app.envs
- }))
- });
} catch (error) {
logger.error(error, `Failed to get apps for organization ${org.name}`);
}
diff --git a/backend/src/services/secret-sync/humanitec/humanitec-sync-fns.ts b/backend/src/services/secret-sync/humanitec/humanitec-sync-fns.ts
index c9253377a8..280e1ce7d0 100644
--- a/backend/src/services/secret-sync/humanitec/humanitec-sync-fns.ts
+++ b/backend/src/services/secret-sync/humanitec/humanitec-sync-fns.ts
@@ -15,26 +15,20 @@ const getHumanitecSecrets = async (secretSync: THumanitecSyncWithCredentials) =>
}
} = secretSync;
- try {
- let url = `${IntegrationUrls.HUMANITEC_API_URL}/orgs/${destinationConfig.org}/apps/${destinationConfig.app}`;
- if (destinationConfig.scope === HumanitecSyncScope.Environment) {
- url += `/envs/${destinationConfig.env}`;
- }
- url += "/values";
+ let url = `${IntegrationUrls.HUMANITEC_API_URL}/orgs/${destinationConfig.org}/apps/${destinationConfig.app}`;
+ if (destinationConfig.scope === HumanitecSyncScope.Environment) {
+ url += `/envs/${destinationConfig.env}`;
+ }
+ url += "/values";
- const { data } = await request.get<HumanitecSecret[]>(url, {
- headers: {
- Authorization: `Bearer ${apiToken}`,
- "Accept-Encoding": "application/json"
- }
- });
+ const { data } = await request.get<HumanitecSecret[]>(url, {
+ headers: {
+ Authorization: `Bearer ${apiToken}`,
+ "Accept-Encoding": "application/json"
+ }
+ });
- return data;
- } catch (error) {
- throw new SecretSyncError({
- error
- });
- }
+ return data;
};
const deleteSecret = async (secretSync: THumanitecSyncWithCredentials, encryptedSecret: HumanitecSecret) => {
diff --git a/docs/api-reference/endpoints/app-connections/humanitec/available.mdx b/docs/api-reference/endpoints/app-connections/humanitec/available.mdx
new file mode 100644
index 0000000000..eb95b2e541
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/humanitec/available.mdx
@@ -0,0 +1,4 @@
+---
+title: "Available"
+openapi: "GET /api/v1/app-connections/humanitec/available"
+---
diff --git a/docs/api-reference/endpoints/app-connections/humanitec/create.mdx b/docs/api-reference/endpoints/app-connections/humanitec/create.mdx
new file mode 100644
index 0000000000..328af9cd9b
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/humanitec/create.mdx
@@ -0,0 +1,10 @@
+---
+title: "Create"
+openapi: "POST /api/v1/app-connections/humanitec"
+---
+
+<Note>
+ Humanitec Connections must be created through the Infisical UI.
+ Check out the configuration docs for [Humanitec Connections](/integrations/app-connections/humanitec) for a step-by-step
+ guide.
+</Note>
\ No newline at end of file
diff --git a/docs/api-reference/endpoints/app-connections/humanitec/delete.mdx b/docs/api-reference/endpoints/app-connections/humanitec/delete.mdx
new file mode 100644
index 0000000000..d8786e08ae
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/humanitec/delete.mdx
@@ -0,0 +1,4 @@
+---
+title: "Delete"
+openapi: "DELETE /api/v1/app-connections/humanitec/{connectionId}"
+---
diff --git a/docs/api-reference/endpoints/app-connections/humanitec/get-by-id.mdx b/docs/api-reference/endpoints/app-connections/humanitec/get-by-id.mdx
new file mode 100644
index 0000000000..22473a7a14
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/humanitec/get-by-id.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get by ID"
+openapi: "GET /api/v1/app-connections/humanitec/{connectionId}"
+---
diff --git a/docs/api-reference/endpoints/app-connections/humanitec/get-by-name.mdx b/docs/api-reference/endpoints/app-connections/humanitec/get-by-name.mdx
new file mode 100644
index 0000000000..fd848ae4f2
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/humanitec/get-by-name.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get by Name"
+openapi: "GET /api/v1/app-connections/humanitec/connection-name/{connectionName}"
+---
diff --git a/docs/api-reference/endpoints/app-connections/humanitec/list.mdx b/docs/api-reference/endpoints/app-connections/humanitec/list.mdx
new file mode 100644
index 0000000000..07f30f6746
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/humanitec/list.mdx
@@ -0,0 +1,4 @@
+---
+title: "List"
+openapi: "GET /api/v1/app-connections/humanitec"
+---
diff --git a/docs/api-reference/endpoints/app-connections/humanitec/update.mdx b/docs/api-reference/endpoints/app-connections/humanitec/update.mdx
new file mode 100644
index 0000000000..023264bb30
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/humanitec/update.mdx
@@ -0,0 +1,10 @@
+---
+title: "Update"
+openapi: "PATCH /api/v1/app-connections/humanitec/{connectionId}"
+---
+
+<Note>
+ Humanitec Connections must be updated through the Infisical UI.
+ Check out the configuration docs for [Humanitec Connections](/integrations/app-connections/humanitec) for a step-by-step
+ guide.
+</Note>
diff --git a/docs/images/secret-syncs/humanitec/humanitec-options.png b/docs/images/secret-syncs/humanitec/humanitec-options.png
index f9d6fb34f0..bc907bbfcd 100644
Binary files a/docs/images/secret-syncs/humanitec/humanitec-options.png and b/docs/images/secret-syncs/humanitec/humanitec-options.png differ
diff --git a/docs/integrations/app-connections/humanitec.mdx b/docs/integrations/app-connections/humanitec.mdx
index 6f66241516..14fdd9bfed 100644
--- a/docs/integrations/app-connections/humanitec.mdx
+++ b/docs/integrations/app-connections/humanitec.mdx
@@ -9,7 +9,7 @@ Infisical supports connecting to Humanitec using a service user.
<Steps>
<Step title="Move to Service Users on Humanitec">
- Navigate to the Humanitec Service Users tab.
+ Navigate to the Humanitec **Service Users** tab.
![Humanitec Service Users Tab](/images/app-connections/humanitec/humanitec-service-users.png)
</Step>
<Step title="Create a Service User">
@@ -21,25 +21,26 @@ Infisical supports connecting to Humanitec using a service user.
![Humanitec Add API Token](/images/app-connections/humanitec/humanitec-add-api-token.png)
</Step>
<Step title="Create the API Token for the Service User">
- Create the API token for the service user. Depending on the expiry date set, the token will expire and this integration will stop working.
+ Create the API token for the service user.
+ If you configure an expiry date for your API token you will need to manually rotate to a new token prior to expiration to avoid integration downtime.
This token's permission will be limited to the **Service User** role.
![Humanitec Create API Token](/images/app-connections/humanitec/humanitec-create-api-token.png)
</Step>
<Step title="Copy the API Token">
- A modal with the API token will be displayed. Copy the token and save it in a secure location.
+ A modal with the API token will be displayed. Save the token in a secure location for later use in the following steps.
![Humanitec Copy API Token](/images/app-connections/humanitec/humanitec-copy-api-token.png)
</Step>
<Step title="Service User has been successfully created">
- After following the previous steps the Service User has been successfully created. And now should be visible on the Service Users tab.
+ After following the previous steps the Service User has been successfully created, and now should be visible on the Service Users tab.
![Humanitec Service User Created](/images/app-connections/humanitec/humanitec-service-account-filled.png)
</Step>
<Step title="Add Service User to Application">
- Move to Appplication Tab and add the Service User to the Application you want to sync with Infisical.
+ Move to the **Applications** tab and add the Service User to the Application you want to sync with Infisical.
Clicking on the App Title will open the App details page.
![Humanitec Applications Tab](/images/app-connections/humanitec/humanitec-applications-tab.png)
</Step>
<Step title="Add new member to this Application">
- Move to the People tab and add a new member to this Application. The recently created User Service should be visible on the dropdown shown.
+ Move to the **People** tab and add a new member to this Application. The recently created User Service should be visible on the dropdown shown.
Make sure to assign at least Developer role as Write permissions are required.
![Humanitec Add User to Application](/images/app-connections/humanitec/humanitec-add-user.png)
![Humanitec Add User Options](/images/app-connections/humanitec/humanitec-add-user-options.png)
diff --git a/docs/integrations/secret-syncs/humanitec.mdx b/docs/integrations/secret-syncs/humanitec.mdx
index b4897a4e44..0edc2098e1 100644
--- a/docs/integrations/secret-syncs/humanitec.mdx
+++ b/docs/integrations/secret-syncs/humanitec.mdx
@@ -129,8 +129,8 @@ description: "Learn how to configure a Humanitec Sync for Infisical."
},
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connection": {
- "app": "github",
- "name": "my-github-connection",
+ "app": "humanitec",
+ "name": "my-humanitec-connection",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"environment": {
diff --git a/docs/mint.json b/docs/mint.json
index 29422e4905..8f4c22bd1c 100644
--- a/docs/mint.json
+++ b/docs/mint.json
@@ -900,6 +900,18 @@
"api-reference/endpoints/app-connections/github/update",
"api-reference/endpoints/app-connections/github/delete"
]
+ },
+ {
+ "group": "Humanitec",
+ "pages": [
+ "api-reference/endpoints/app-connections/humanitec/list",
+ "api-reference/endpoints/app-connections/humanitec/available",
+ "api-reference/endpoints/app-connections/humanitec/get-by-id",
+ "api-reference/endpoints/app-connections/humanitec/get-by-name",
+ "api-reference/endpoints/app-connections/humanitec/create",
+ "api-reference/endpoints/app-connections/humanitec/update",
+ "api-reference/endpoints/app-connections/humanitec/delete"
+ ]
}
]
},
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/HumanitecSyncFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/HumanitecSyncFields.tsx
index 4387177858..f6db556934 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/HumanitecSyncFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/HumanitecSyncFields.tsx
@@ -5,6 +5,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { SecretSyncConnectionField } from "@app/components/secret-syncs/forms/SecretSyncConnectionField";
import { FilterableSelect, FormControl, Select, SelectItem, Tooltip } from "@app/components/v2";
+import { HUMANITEC_SYNC_SCOPES } from "@app/helpers/secretSyncs";
import {
THumanitecConnectionApp,
THumanitecConnectionEnvironment,
@@ -41,6 +42,7 @@ export const HumanitecSyncFields = () => {
onChange={() => {
setValue("destinationConfig.org", "");
setValue("destinationConfig.app", "");
+ setValue("destinationConfig.env", "");
}}
/>
<Controller
@@ -48,11 +50,38 @@ export const HumanitecSyncFields = () => {
control={control}
defaultValue={HumanitecSyncScope.Application}
render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl errorText={error?.message} isError={Boolean(error?.message)} label="Scope">
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Scope"
+ tooltipClassName="max-w-lg py-3"
+ tooltipText={
+ <div className="flex flex-col gap-3">
+ <p>
+ Specify how Infisical should manage secrets from Humanitec. The following options
+ are available:
+ </p>
+ <ul className="flex list-disc flex-col gap-3 pl-4">
+ {Object.values(HUMANITEC_SYNC_SCOPES).map(({ name, description }) => {
+ return (
+ <li key={name}>
+ <p className="text-mineshaft-300">
+ <span className="font-medium text-bunker-200">{name}</span>: {description}
+ </p>
+ </li>
+ );
+ })}
+ </ul>
+ </div>
+ }
+ >
<Select
value={value}
onValueChange={(val) => {
onChange(val);
+ setValue("destinationConfig.env", "");
+ setValue("destinationConfig.app", "");
+ setValue("destinationConfig.org", "");
}}
className="w-full border border-mineshaft-500 capitalize"
position="popper"
@@ -81,9 +110,11 @@ export const HumanitecSyncFields = () => {
isLoading={isOrganizationsPending && Boolean(connectionId)}
isDisabled={!connectionId}
value={organizations ? (organizations.find((org) => org.id === value) ?? []) : []}
- onChange={(option) =>
- onChange((option as SingleValue<THumanitecConnectionOrganization>)?.id ?? null)
- }
+ onChange={(option) => {
+ onChange((option as SingleValue<THumanitecConnectionOrganization>)?.id ?? null);
+ setValue("destinationConfig.app", "");
+ setValue("destinationConfig.env", "");
+ }}
options={organizations}
placeholder="Select an organization..."
getOptionLabel={(option) => option.name}
diff --git a/frontend/src/helpers/secretSyncs.ts b/frontend/src/helpers/secretSyncs.ts
index 9f94e3c9d9..67660080bd 100644
--- a/frontend/src/helpers/secretSyncs.ts
+++ b/frontend/src/helpers/secretSyncs.ts
@@ -4,6 +4,7 @@ import {
SecretSyncImportBehavior,
SecretSyncInitialSyncBehavior
} from "@app/hooks/api/secretSyncs";
+import { HumanitecSyncScope } from "@app/hooks/api/secretSyncs/types/humanitec-sync";
export const SECRET_SYNC_MAP: Record<SecretSync, { name: string; image: string }> = {
[SecretSync.AWSParameterStore]: { name: "AWS Parameter Store", image: "Amazon Web Services.png" },
@@ -67,3 +68,19 @@ export const SECRET_SYNC_IMPORT_BEHAVIOR_MAP: Record<
description: `Infisical will import any secrets present in the ${destinationName} destination, prioritizing values from ${destinationName} over Infisical when keys conflict.`
})
};
+
+export const HUMANITEC_SYNC_SCOPES: Record<
+ HumanitecSyncScope,
+ { name: string; description: string }
+> = {
+ [HumanitecSyncScope.Application]: {
+ name: "Application",
+ description:
+ "Infisical will import any secrets present in the selected Humanitec application. This includes all secrets that are not limited to a specific environment."
+ },
+ [HumanitecSyncScope.Environment]: {
+ name: "Environment",
+ description:
+ "Infisical will import any secrets present in the selected Humanitec environment. This includes all secrets that are limited to the selected environment."
+ }
+};